I've installed gunicorn inside my virtualenv.
From this directory:
manage.py /onbytes/wsgi.py I run the following:
gunicorn onbytes.wsgi:application And I get the following error:
Traceback (most recent call last): File "/home/ymorin007/.virtualenvs/", line 9, in <module> load_entry_point('gunicorn==19.0.0', 'console_scripts', 'gunicorn')() File "/home/ymorin007/.virtualenvs/", line 74, in run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/home/ymorin007/.virtualenvs/", line 166, in run super(Application, self).run() File "/home/ymorin007/.virtualenvs/", line 71, in run Arbiter(self).run() File "/home/ymorin007/.virtualenvs/", line 169, in run self.manage_workers() File "/home/ymorin007/.virtualenvs/", line 477, in manage_workers self.spawn_workers() File "/home/ymorin007/.virtualenvs/", line 537, in spawn_workers time.sleep(0.1 * random.random()) File "/home/ymorin007/.virtualenvs/", line 209, in handle_chld self.reap_workers() File "/home/ymorin007/.virtualenvs/", line 459, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3> running gunicorn onbytes.wsgi:application --preload will get me this error:
Traceback (most recent call last): File "/home/ymorin007/.virtualenvs/", line 9, in <module> load_entry_point('gunicorn==19.0.0', 'console_scripts', 'gunicorn')() File "/home/ymorin007/.virtualenvs/", line 74, in run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/home/ymorin007/.virtualenvs/", line 166, in run super(Application, self).run() File "/home/ymorin007/.virtualenvs/", line 71, in run Arbiter(self).run() File "/home/ymorin007/.virtualenvs/", line 57, in __init__ self.setup(app) File "/home/ymorin007/.virtualenvs/", line 113, in setup self.app.wsgi() File "/home/ymorin007/.virtualenvs/", line 66, in wsgi self.callable = self.load() File "/home/ymorin007/.virtualenvs/", line 65, in load return self.load_wsgiapp() File "/home/ymorin007/.virtualenvs/", line 52, in load_wsgiapp return util.import_app(self.app_uri) File "/home/ymorin007/.virtualenvs/", line 356, in import_app __import__(module) File "/home/ymorin007/sites/", line 8, in <module> from django.core.wsgi import get_wsgi_application ImportError: No module named django.core.wsgi 14 Answers
Probably there is an issue in your application, not in gunicorn.
Try:
gunicorn --log-file=- onbytes.wsgi:application Since the version R19, Gunicorn doesn’t log by default in the console and the --debug option was deprecated.
1Adding --preload the gunincorn command showed me that I had to do :
pip install ordereddict That package was missing.
3I had a similar problem and it was because i was running the command in the wrong directory. In a standard django installation, try running gunicorn in the same directory that 'manage.py'
in my case after adding --preload to Procfile, I understand that I should install psycopg2-binary with pip:
pip install psycopg2-binary