在Heroku上使用Mezzanine的困难时期 - Procfile和字典值错误的问题

时间:2013-12-23 06:13:52

标签: django heroku foreman mezzanine procfile

使用以下教程和github模板hereherehere,我花了大部分时间与django和mezzanine进行摔跤。现在我有一个mezzanine-project,名为uccdev,当我运行python manage.py runserver时效果很好。

现在,我想使用gunicornforeman来处理事物,以便稍后我可以将项目上传到heroku。

根据Josh Finnie

  

添加以下Procfile让Mezzanine在Gunicorn上运行并成功获得Heroku来提供我的静态文件。首先,如果运行collectstatic以确保所有静态媒体都在您的应用程序中的适当位置,其次运行Gunicorn服务器。

web: python manage.py collectstatic --noinput; python manage.py run_gunicorn -b 0.0.0.0:$PORT

我在gunicorn中添加了settings.py作为应用程序,但每次我在终端中运行foreman start时会立即关闭,并显示以下错误消息。

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

有关如何为字典指定版本的想法吗?

1 个答案:

答案 0 :(得分:0)

来自用户败类的答案 - Correct way of creating supervisord script for gunicorn? Django 1.6

我将以下内容添加到我的settings.py:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
}