Gunicorn failed to load Flask application Gunicorn failed to load Flask application nginx nginx

Gunicorn failed to load Flask application


You're pointing gunicorn at mysite:app, which is equivalent to from mysite import app. However, there is no app object in the top (__init__.py) level import of mysite. Tell gunicorn to call the factory.

gunicorn "mysite:create_app()"

You can pass arguments to the call as well.

gunicorn "mysite:create_app('production')"

Internally, this is equivalent to:

from mysite import create_appapp = create_app('production')

Alternatively, you can use a separate file that does the setup. In your case, you already initialized an app in manage.py.

gunicorn manage:app