

NOTE: For Python on App Service Linux you should not use methods like FTP or ZipDeploy (without the use of Oryx) to avoid improper deployment since the Python environment will not be built, thus causing errors like ModuleNotFound or others - since pip install is not ran in these scenarios. We’ll be covering 3 of these methods below. There are multiple deployment options in Python on App Service Linux such as Continuous Deployment(GitHub Actions, DevOps pipelines), External Git, Local Git, ZipDeploy with Oryx Builder, etc. You should now be able to browse the site by either going to localhost:5000 or 127.0.0.1:5000. Run the following commands in your terminal to start Flask in development modeĮxport FLASK_ENV=development (Bash, *NIX) Lastly, run pip install -r requirements.txt For production scenarios it’s highly recommended to pin your dependencies to a specific version. NOTE: For the sake of this quickstart, no specific version is pinned. In our app.py file add the following content. Next, lets create our app.py and requirements.txt files. You should now see your virtual environment name activated in your terminal. We can now activate our virtual environment using the below: venv in the name of our virtual environment, this can be changed to any arbitrary name With our folder now created (or if you’re using an existing one), we’ll create our virtual environment below: You can also follow this Flask documentation for installation and virtual environment creation.

You can review the official documentation for this here. Start by creating a folder for your application and cd into it to create and activate your virtual environment. Local Development Set up your virtual environment.įor these examples we’ll be using a basic Flask application to get started. This section provides information for creating, configuring, and deploying a Flask application on App Service Linux. Failed to find attribute ‘app’ in ‘app’.
