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 }} diff --git a/README.md b/README.md index 9deee4be9..976ce1c56 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ # Deploy a Python (Flask) web app to Azure App Service - Sample Application -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. +Virhe korjattu: import os -Sample applications are available for the other frameworks here: +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. -* Django [https://github.com/Azure-Samples/msdocs-python-django-webapp-quickstart](https://github.com/Azure-Samples/msdocs-python-django-webapp-quickstart) -* FastAPI [https://github.com/Azure-Samples/msdocs-python-fastapi-webapp-quickstart](https://github.com/Azure-Samples/msdocs-python-fastapi-webapp-quickstart) +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). -If you need an Azure account, you can [create one for free](https://azure.microsoft.com/en-us/free/). +If you need an Azure account, you can [create on for free](https://azure.microsoft.com/en-us/free/). diff --git a/app.py b/app.py index 3d1808cf6..44a98fc1b 100644 --- a/app.py +++ b/app.py @@ -1,8 +1,6 @@ import os - -from flask import (Flask, redirect, render_template, request, - send_from_directory, url_for) - +from datetime import datetime +from flask import Flask, render_template, request, redirect, url_for, send_from_directory app = Flask(__name__)