Skip to content Skip to sidebar Skip to footer

Gunicorn Failed To Load Flask Application

I have a Flask app I am trying to serve via Gunicorn. I am using virtualenv and python3. If I activate my venv cd to my app base dir then run: gunicorn mysite:app I get: Starting

Solution 1:

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_app
app = 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

Post a Comment for "Gunicorn Failed To Load Flask Application"