gunicorn cannot start flask
To use flask with gunicorn you dont have to run the app (app.run()
) since it is a single blocking process which is used only for testing.
Instead pass the flask app module that initiates the variable app
(if it is a single file, pass the filename) as argument to gunicorn instead of the external run.py.
This is the right way to use gunicorn with flask.
gunicorn -b HOST:PORT <MODULE_NAME>:app
Replace MODULE_NAME with the correct module or file name. Use -b
flag to set the IP address and port number.