From f2c821ccbb7efb3756da9c4fd6c7b7debecc1ecc Mon Sep 17 00:00:00 2001 From: Web-projektitII Date: Tue, 18 Apr 2023 12:05:38 +0300 Subject: [PATCH 1/3] import os --- app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app.py b/app.py index 9ab1ed730..8ec188eb4 100644 --- a/app.py +++ b/app.py @@ -1,3 +1,4 @@ +import os from datetime import datetime from flask import Flask, render_template, request, redirect, url_for, send_from_directory app = Flask(__name__) From d0d7964eae6dd81fba239f6893b7d49069100c5d Mon Sep 17 00:00:00 2001 From: Web-projektitII Date: Tue, 18 Apr 2023 12:53:04 +0300 Subject: [PATCH 2/3] Uusi readme.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1069d81cf..976ce1c56 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Deploy a Python (Flask) web app to Azure App Service - Sample Application +Virhe korjattu: import os + This is the sample Flask application for the Azure Quickstart [Deploy a Python (Django or Flask) web app to Azure App Service](https://docs.microsoft.com/en-us/azure/app-service/quickstart-python). For instructions on how to create the Azure resources and deploy the application to Azure, refer to the Quickstart article. A Django sample application is also available for the article at [https://github.com/Azure-Samples/msdocs-python-django-webapp-quickstart](https://github.com/Azure-Samples/msdocs-python-django-webapp-quickstart). From 12eaaa74a1b8322293ecc5084fc81cf93bff8d9c Mon Sep 17 00:00:00 2001 From: Web-projektitII <60734740+Web-projektitII@users.noreply.github.com> Date: Tue, 18 Apr 2023 12:58:47 +0300 Subject: [PATCH 3/3] Add or update the Azure App Service build and deployment workflow config --- ...river-840f1e1cd3e245789f35c2ecb61e0737.yml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/main_witty-river-840f1e1cd3e245789f35c2ecb61e0737.yml diff --git a/.github/workflows/main_witty-river-840f1e1cd3e245789f35c2ecb61e0737.yml b/.github/workflows/main_witty-river-840f1e1cd3e245789f35c2ecb61e0737.yml new file mode 100644 index 000000000..29499e4a8 --- /dev/null +++ b/.github/workflows/main_witty-river-840f1e1cd3e245789f35c2ecb61e0737.yml @@ -0,0 +1,63 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions +# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions + +name: Build and deploy Python app to Azure Web App - witty-river-840f1e1cd3e245789f35c2ecb61e0737 + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python version + uses: actions/setup-python@v1 + with: + python-version: '3.11' + + - name: Create and start virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install dependencies + run: pip install -r requirements.txt + + # Optional: Add step to run tests here (PyTest, Django test suites, etc.) + + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v2 + with: + name: python-app + path: | + . + !venv/ + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: python-app + path: . + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v2 + id: deploy-to-webapp + with: + app-name: 'witty-river-840f1e1cd3e245789f35c2ecb61e0737' + slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_AB27ADC7FB1E4B34B3D624FA4B31424E }}