Report this

What is the reason for this report?

Error: No module named.django.core.wsgi

Posted on December 4, 2015

Hi! I’m new on Django, and I’ve a problem when I call gunicorn trying to follow the steps on a tutorial for gunicorn and nginx in ubuntu 14.04 server:

when I use this command, I’ve the error below.

gunicorn --bind 0.0.0.0:8000 project.wsgi

2015-12-04 15:23:56 [19118] [INFO] Starting gunicorn 17.5 2015-12-04 15:23:56 [19118] [INFO] Listening at: http://127.0.0.1:8000 (19118) 2015-12-04 15:23:56 [19118] [INFO] Using worker: sync 2015-12-04 15:23:56 [19123] [INFO] Booting worker with pid: 19123 2015-12-04 15:23:56 [19123] [ERROR] Exception in worker process: Traceback (most recent call last): File “/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 473, in spawn_worker worker.init_process() File “/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py”, line 100, in init_process self.wsgi = self.app.wsgi() File “/usr/lib/python2.7/dist-packages/gunicorn/app/base.py”, line 115, in wsgi self.callable = self.load() File “/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py”, line 33, in load return util.import_app(self.app_uri) File “/usr/lib/python2.7/dist-packages/gunicorn/util.py”, line 362, in import_app import(module) File “/home/Spirit/example/project/wsgi.py”, line 5, in <module> from django.core.wsgi import get_wsgi_application ImportError: No module named django.core.wsgi Traceback (most recent call last): File “/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py”, line 473, in spawn_worker worker.init_process() File “/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py”, line 100, in init_process self.wsgi = self.app.wsgi() File “/usr/lib/python2.7/dist-packages/gunicorn/app/base.py”, line 115, in wsgi self.callable = self.load() File “/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py”, line 33, in load return util.import_app(self.app_uri) File “/usr/lib/python2.7/dist-packages/gunicorn/util.py”, line 362, in import_app import(module) File “/home/Spirit/example/project/wsgi.py”, line 5, in <module> from django.core.wsgi import get_wsgi_application ImportError: No module named django.core.wsgi 2015-12-04 15:23:56 [19123] [INFO] Worker exiting (pid: 19123) 2015-12-04 15:23:56 [19118] [INFO] Shutting down: Master 2015-12-04 15:23:56 [19118] [INFO] Reason: Worker failed to boot.

I was trying to find a solution on Internet, but I get stuck.

Sorry for my english.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I had the same problem. I was running the command without being with the environment enabled virtualenv. Then I had a problem for this in the wrong directory.

Sorry for my english.

I was having the same problem. What I did was give permission to the nginx user in the gunicorn file.

I hope you help them :)

I had the same issue.

Reason being that I had installed gunicorn via apt, which was then running in the system-wide Python 2 installation, instead of my venv.

Fixed it by uninstalling the system gunicorn, and then activating my venv, and installing gunicorn to the venv using pip install gunicorn. Then it worked straight away.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.