Opened 7 years ago

Closed 7 years ago

#27749 closed Cleanup/optimization (invalid)

Documention change gunicorn deployment

Reported by: JorisBenschop Owned by: nobody
Component: Documentation Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

from https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/gunicorn/
In section "Running Django in Gunicorn as a generic WSGI application" there is the suggestion to run

gunicorn myproject.wsgi

However, on my server (CentOS7) at least, django-admin does not create a myproject.wsgi, but a wsgi.py. Problem is that you cannot run

gunicorn wsgi.py

It will fail with the cryptic "Reason: Worker failed to boot.". Instead, one must run

gunicorn wsgi

(so without the .py extension)

I have not tested this on other setups, so it could be very specific. Still, would it be possible to make a mention of this behaviour in the django documentation?

Thanks
Joris

Change History (3)

comment:1 by Tim Graham, 7 years ago

Resolution: worksforme
Status: newclosed

I think "gunicorn just needs to be called with the location of a module containing a WSGI application object named application" explains the usage well enough If that is unclear and you want to propose some clarification, please do.

comment:2 by JorisBenschop, 7 years ago

Resolution: worksforme
Status: closednew

well the doc highlights an example usage that crashes (despite that other text is correct. This difference in explanation creates a discrepancy and thus confusion). I think this could be improved. Therefore I suggest to replace the

gunicorn myproject.wsgi

by

gunicorn wsgi

comment:3 by Marten Kenbeek, 7 years ago

Resolution: invalid
Status: newclosed

The docs explicitly mention:

It requires that your project be on the Python path; the simplest way to ensure that is to run this command from the same directory as your manage.py file.

If your project is on your python path, the wsgi file has a relative location of myproject/wsgi.py (at least when using the default project template). This translates to an import path of myproject.wsgi, so the documentation is correct.

If gunicorn myproject.wsgi can't find your wsgi file, it's because your python path does not contain the root of your project, or your wsgi file has a non-standard location.

Note: See TracTickets for help on using tickets.
Back to Top