forked from microsoft/python-sample-vscode-flask-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstartup.py
More file actions
20 lines (16 loc) · 697 Bytes
/
startup.py
File metadata and controls
20 lines (16 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""
In this sample, the Flask app object is contained within the hello_app *module*;
that is, hello_app contains an __init__.py along with relative imports. Because
of this structure, a file like webapp.py cannot be run directly as the startup
file through Gunicorn; the result is "Attempted relative import in non-package".
The solution is to provide a simple alternate startup file, like this present
startup.py, that just imports the app object. You can then just specify
startup:app in the Gunicorn command.
"""
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return "New update here !!"
if __name__ == '__main__':
app.run(host="0.0.0.0",threaded=True)