问题
Using the following tutorials and github templates here, here, and here , I've spent the better part of the evening wrestling with django and mezzanine. Right now I've got a mezzanine-project
, called uccdev
which is working nicely when I run python manage.py runserver
.
Now, I want to use gunicorn
and foreman
to get work with thing, so that I can later upload my projects to heroku.
According to Josh Finnie,
Adding the below Procfile got Mezzanine running on Gunicorn and successfully got Heroku to serve my static files. First if runs collectstatic to insure that all the static media is in the appropriate place within your app, and second it runs the Gunicorn server.
web: python manage.py collectstatic --noinput; python manage.py run_gunicorn -b 0.0.0.0:$PORT
I added gunicorn
as an application in my settings.py
, but every time I run foreman start
in the terminal it shuts down immediately with the following error message.
Pythoness-998:uccdev gersande$ foreman start
01:02:45 web.1 | started with pid 7592
01:02:45 web.1 | /usr/local/lib/python2.7/site-packages/mezzanine/utils/conf.py:48: UserWarning: You haven't defined the ALLOWED_HOSTS settings, which Django 1.5 requires. Will fall back to the domains configured as sites.
01:02:45 web.1 | warn("You haven't defined the ALLOWED_HOSTS settings, which "
01:02:46 web.1 | 0 static files copied, 549 unmodified.
01:02:46 web.1 | /usr/local/lib/python2.7/site-packages/mezzanine/utils/conf.py:48: UserWarning: You haven't defined the ALLOWED_HOSTS settings, which Django 1.5 requires. Will fall back to the domains configured as sites.
01:02:46 web.1 | warn("You haven't defined the ALLOWED_HOSTS settings, which "
01:02:46 web.1 | 2013-12-23 01:02:46 [7594] [INFO] Starting gunicorn 18.0
01:02:46 web.1 | 2013-12-23 01:02:46 [7594] [INFO] Listening at: http://0.0.0.0:5000 (7594)
01:02:46 web.1 | 2013-12-23 01:02:46 [7594] [INFO] Using worker: sync
01:02:46 web.1 | 2013-12-23 01:02:46 [7597] [INFO] Booting worker with pid: 7597
01:02:46 web.1 | 2013-12-23 01:02:46 [7597] [ERROR] Exception in worker process:
01:02:46 web.1 | Traceback (most recent call last):
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
01:02:46 web.1 | worker.init_process()
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
01:02:46 web.1 | self.wsgi = self.app.wsgi()
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
01:02:46 web.1 | self.callable = self.load()
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/app/djangoapp.py", line 142, in load
01:02:46 web.1 | return mod.make_command_wsgi_application(self.admin_media_path)
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py", line 113, in make_command_wsgi_application
01:02:46 web.1 | reload_django_settings()
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py", line 109, in reload_django_settings
01:02:46 web.1 | logging_config_func(settings.LOGGING)
01:02:46 web.1 | File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 803, in dictConfig
01:02:46 web.1 | dictConfigClass(config).configure()
01:02:46 web.1 | File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 509, in configure
01:02:46 web.1 | raise ValueError("dictionary doesn't specify a version")
01:02:46 web.1 | ValueError: dictionary doesn't specify a version
01:02:46 web.1 | Traceback (most recent call last):
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
01:02:46 web.1 | worker.init_process()
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
01:02:46 web.1 | self.wsgi = self.app.wsgi()
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
01:02:46 web.1 | self.callable = self.load()
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/app/djangoapp.py", line 142, in load
01:02:46 web.1 | return mod.make_command_wsgi_application(self.admin_media_path)
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py", line 113, in make_command_wsgi_application
01:02:46 web.1 | reload_django_settings()
01:02:46 web.1 | File "/usr/local/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py", line 109, in reload_django_settings
01:02:46 web.1 | logging_config_func(settings.LOGGING)
01:02:46 web.1 | File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 803, in dictConfig
01:02:46 web.1 | dictConfigClass(config).configure()
01:02:46 web.1 | File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 509, in configure
01:02:46 web.1 | raise ValueError("dictionary doesn't specify a version")
01:02:46 web.1 | ValueError: dictionary doesn't specify a version
01:02:46 web.1 | 2013-12-23 01:02:46 [7597] [INFO] Worker exiting (pid: 7597)
01:02:46 web.1 | 2013-12-23 01:02:46 [7594] [INFO] Shutting down: Master
01:02:46 web.1 | 2013-12-23 01:02:46 [7594] [INFO] Reason: Worker failed to boot.
01:02:46 web.1 | exited with code 3
01:02:46 system | sending SIGTERM to all processes
SIGTERM received
Any thoughts how to specify a version for the dictionary?
回答1:
From user scum's answer - Correct way of creating supervisord script for gunicorn? Django 1.6
I added the following to my settings.py:
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
}
来源:https://stackoverflow.com/questions/20737960/difficult-time-using-mezzanine-on-heroku-issues-with-procfile-and-dictionary-v