Giter Club home page Giter Club logo

simple-flask-server-appservice's Introduction

name description languages products page_type urlFragment
Flask App on Azure App Service
Deploy a Flask app on App Service using Azure Developer CLI.
python
azdeveloper
azure-app-service
azure
sample
simple-flask-server-appservice

Simple Flask App on Azure App Service

This repository includes a very simple Python Flask web site, made for demonstration purposes only.

Opening the project

This project has Dev Container support, so it will be be setup automatically if you open it in Github Codespaces or in local VS Code with the Dev Containers extension.

If you're not using one of those options for opening the project, then you'll need to:

  1. Create a Python virtual environment and activate it.

  2. Install requirements:

    python3 -m pip install -r requirements.txt

Local development

  1. Run the server:

    python3 -m flask run --port 50505 --debug
  2. Click 'http://127.0.0.1:50505' in the terminal, which should open the website in a new tab.

  3. Try the index page, try '/hello?name=yourname', and try other paths.


Deployment

This repo is set up for deployment on Azure App Service using the configuration files in the infra folder.

Steps for deployment:

  1. Sign up for a free Azure account

  2. Install the Azure Dev CLI. (If you opened this repository in a devcontainer, that part will be done for you.)

  3. Login to your Azure account:

    azd auth login
  4. Provision and deploy all the resources:

    azd up

    It will prompt you to login and to provide a name (like "flask-app") and location (like "eastus"). Then it will provision the resources in your account and deploy the latest code.

  5. When azd has finished deploying, you'll see an endpoint URI in the command output. Visit that URI, and you should see the front page of the app! ๐ŸŽ‰ If you see an error, open the Azure Portal from the URL in the command output, navigate to the App Service, select Logstream, and check the logs for any errors.

  6. When you've made any changes to the app code, you can just run:

    azd deploy

Costs

By default, this project is set up to deploy to the free plan of Azure App Service. The free plan is intended for trials, experimentation, and learning the service. There is no SLA for free plan and it is metered on a per app basis. Use of free plan for production workloads is not supported.

If you would like to deploy to a paid plan, you can set the AZURE_APP_SERVICE_SKU environment variable to B1 or other SKU before running azd up:

azd env set AZURE_APP_SERVICE_SKU B1

Learn more about App Service pricing.

โš ๏ธ To reduce unnecessary costs, remember to take down your app if it's no longer in use, either by deleting the resource group in the Portal or running azd down.

simple-flask-server-appservice's People

Contributors

microsoftopensource avatar pamelafox avatar microsoft-github-operations[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.