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.
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
.
This completes the preparation on the local side.
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.
If this screen appears safely, it is a success.
Recommended Posts