Reputation: 2574
I have deployed a Python app to Azure app service (OS: Linux, Python) from Visual Studio Code. I can able to see the files in the wwwroot
folder as well as in the app service, but when I am trying to access the app service by URL, the login page not displayed. Please refer to the code below:
from flask import *
app=Flask(__name__)
@app.route('/')
def welcome():
return render_template("login_post.html")
"""using POST request method"""
@app.route('/login',methods=["POST"])
def login():
uname=request.form["uname"]
password=request.form["pass"]
if uname=="shannu" and password=="guru":
return "Welcome %s"%uname
if __name__=='__main__':
app.run()
Refer to the screenshot for files under wwwroot
folder (in app service):
Index of /wwwroot/ directory
Not sure is there anything am I missing here. Thanks in advance.
Upvotes: 0
Views: 736
Reputation: 21883
You need add startup command.
gunicorn --bind=0.0.0.0 --timeout 600 app:app
Offical doc:
If this command not useful to you, it is recommand you deploy your flask app by vscode.
You will find azure web app will auto generate gunicorn
command for 'app:app'.
Upvotes: 1