Reputation: 431
I'm trying to run a pre-built django project binded with gunicorn & nginx, following the tutorial publishded over this link.
How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 18.04
The tree command on the project folder gives this output.
when I publish the project with # python manage.py runserver
, I can view its contents. But when I try to bind it using unicorn with following command, it shows following errors.
# gunicorn --bind 0.0.0.0:8000 DjangoWebsiteSample.eccomerceProject.wsgi.py
[2019-05-10 05:25:11 +0000] [1912] [INFO] Starting gunicorn 19.7.1
[2019-05-10 05:25:11 +0000] [1912] [INFO] Listening at: http://0.0.0.0:8000 (1912)
[2019-05-10 05:25:11 +0000] [1912] [INFO] Using worker: sync
[2019-05-10 05:25:11 +0000] [1916] [INFO] Booting worker with pid: 1916
[2019-05-10 05:25:11 +0000] [1916] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 377, in import_app
__import__(module)
ImportError: No module named DjangoWebsiteSample.eccomerceProject.wsgi.py
[2019-05-10 05:25:11 +0000] [1916] [INFO] Worker exiting (pid: 1916)
[2019-05-10 05:25:11 +0000] [1912] [INFO] Shutting down: Master
[2019-05-10 05:25:11 +0000] [1912] [INFO] Reason: Worker failed to boot.
Upvotes: 3
Views: 5314
Reputation: 2357
Try this command:
gunicorn --bind 0.0.0.0:8000 eccomerceProject.wsgi
Upvotes: 11