Sample to put Python Flask web app on Azure App Service (Web App)

Preparation

Log in to the Azure portal and create a ** Web App ** (App Service) from Create.

--Public: Code --Runtime stack: Python 3.6, 3.7, 3.8, etc. --OS: Linux * I feel that Windows is not good for some reason ... maybe because of my feelings ...

After that, start it as you like and check that the default screen of Azure App Service (Web Apps) appears.

First write the code at hand

Before deploying to Azure, first write code that works locally.

application.py


from flask import Flask
app = Flask(__name__)

@app.route('/')
def index():
    return "hello world!"

if __name__ == "__main__":
    app.run(debug=True)

Save this and try running it on your local console.

python application.py

If you access http://127.0.0.1:5000/ with a browser, you will see this display. If you get an error saying that Flask is not included, install it with pip install Flask.

image.png

This completes the preparation on the local side.

Take to Azure

It's easier to use Git! That's the first thing to say, but, though, I think it can be a hassle to create a repository to try it out, so everyone loves FTP.

The FTP procedure is everywhere, so skip it

/site/wwwroot/

Place the ʻapplication.py` you just created.

The file name must be ʻapplication.py. By default, it will find ʻapplication.py or ʻapp.py`.

And don't forget to restart the App Service.

Please restart (wait for about 30 seconds ...) and refresh your browser.

image.png

If this screen appears safely, it is a success.

Recommended Posts

Sample to put Python Flask web app on Azure App Service (Web App)
Vienna with Python + Flask web app on Jenkins
Deploy a Python 3.6 / Django / Postgres web app on Azure
[Python] Run Flask on Google App Engine
Easy web app with Python + Flask + Heroku
Put MicroPython on Windows to run ESP32 on Python
Deploy from GitHub Actions to Azure App Service
Run Python web apps on NGINX + NGINX Unit + Flask
Sample to put Python Kivy in one file
The story of switching the Azure App Service web system from Windows to Linux
How to use Django on Google App Engine / Python
Write code to Unit Test a Python web app
How to deploy a web app made with Flask to Heroku
Put Python 3.x on Ubuntu
(Failure) Deploy a web app made with Flask on heroku
Update python on Mac to 3.7-> 3.8
Web application with Python + Flask ② ③
Save images on the web to Drive with Python (Colab)
How to ssh into Azure App Service and enable venv
Web application with Python + Flask ④
Easy deep learning web app with NNC and Python + Flask
Python: Introduction to Flask: Creating a number identification app using MNIST
How to configure CORS settings for Azure storage service in Python
How to use python put in pyenv on macOS with PyCall
The road to installing Python and Flask on an offline PC
Python 3.6 on Windows ... and to Xamarin.
Preparing to run Flask on EC2
Introduction to Python Hands On Part 1
Deploy Flask app on heroku (bitterly)
Deploy the Flask app on Heroku
Deploy the Flask app on heroku
Steps to install python3 on mac
File upload to Azure Storage (Python)
Update Python on Mac from 2 to 3
Put Cabocha 0.68 on Windows and try to analyze the dependency with Python
Data integration from Python app on Linux to Amazon Redshift with ODBC
Load_data self-made to run Python MNIST sample code on your own dataset
Data integration from Python app on Windows to Amazon Redshift with ODBC
I want to make a web application using React and Python flask
Wall to put OpenCV 3.1.0 in raspberry pi 3 and run sample on python3: ImportError: No module named cv2 solution
Migrate Django applications running on Python 2.7 to Python 3.5
How to read pydoc on python interpreter
Getting Started with Flask with Azure Web Apps
[Kivy] How to install Kivy on Windows [Python]
[Itertools.permutations] How to put permutations in Python
PUT gzip directly to S3 in Python
Sample script to trap signals in Python
Steps to install Python environment on Ubuntu
Daemonize a Python web app with Supervisor
How to erase Python 2.x on Mac.
Connecting from python to MySQL on CentOS 6.4
I was addicted to Flask on dotCloud
Memorandum on how to use gremlin python
Download files on the web with Python
Create a simple web app with flask
Launch a Flask app in Python Anywhere
[Azure] Hit Custom Vision Service with Python
Install python on xserver to use pip
Use Django's ImageField on App Engine / Python
Ported Python parallel computing sample to F #
Create a web service with Docker + Flask