I have a flask application that I have configured as a python module.
To explain further, this is a simplified structure of my project:
project_dir
ven
dir_a
dir_b
flask_app
__init__.py
__main__.py
# __main__.py
.
.
.
app = create_app(...)
client = Client(app)
.
.
.
print("Hello World")
running_app = app.run("0.0.0.0", port=5000)
When I want to run my application, I hit python -m dir_a.dir_b.flask_app
Now I want to run it with gunicorn.
For your reference, this is a sample of running gunicorn
gunicorn -w 1 -b 0.0.0.0:5000 **wsgi:server**
If I want to run the application, from project_dir I run
python -m dir_a.dir_b.flask_app
How should I run my application with gunicorn in my case?
Please note that I want "Hello World" to be printed before running the application
What I have tried:
gunicorn -w 1 -b 0.0.0.0:5000 dir_a.dir_b.flask_app:running_app
I then removed the line running_app = app.run("0.0.0.0", port=5000)
and tried
gunicorn -w 1 -b 0.0.0.0:5000 dir_a.dir_b.flask_app:app
and
gunicorn -w 1 -b 0.0.0.0:5000 dir_a.dir_b.flask_app:create_app(...)
None of them worked