How to run gunicorn from a folder that is not the django project folder

You should add your django app to the Python Path.

In latest gunicorn, you can try this:

If the root path of django project is /usr/local/src/djangoapp/.

The settings.py path would default to /usr/local/src/djangoapp/djangoapp/settings.py.

gunicorn \
-c /usr/local/src/djangoapp/gunicorn_config.py \
--env DJANGO_SETTINGS_MODULE=djangoapp.settings \
--pythonpath '/usr/local/src/djangoapp' \
djangoapp.wsgi:application
  • -c config file path
  • --env module path of the settings.py in your django project
  • --pythonpath add your project path to Python Path settings.html#pythonpath

--env and --pythonpath are required.

Relative Path also be fine!


You can use the chdir flag for Gunicorn to change to the project directory before executing your command.

gunicorn -w 2 -b 0.0.0.0:8000 --chdir /home/telessaude/telessaude_branch_master telessaude.wsgi_dev:application --reload --timeout 900