我正在尝试按照heroku提供的教程开始,但我的dyno一直在崩溃。这是日志:
(venv)tog:hellodjango lukasolson$ heroku logs
2013-12-22T22:44:48.014242+00:00 app[web.1]: self._setup(name)
2013-12-22T22:44:48.014064+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
2013-12-22T22:44:48.014064+00:00 app[web.1]: if settings.USE_I18N:
2013-12-22T22:44:48.014242+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
2013-12-22T22:44:48.014242+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
2013-12-22T22:44:48.014242+00:00 app[web.1]: % (desc, ENVIRONMENT_VARIABLE))
2013-12-22T22:44:48.014064+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 13, in <module>
2013-12-22T22:44:48.014064+00:00 app[web.1]: from django.views import static
2013-12-22T22:44:48.014064+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
2013-12-22T22:44:48.014242+00:00 app[web.1]: ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
2013-12-22T22:44:48.014242+00:00 app[web.1]: 2013-12-22 22:44:48 [7] [INFO] Worker exiting (pid: 7)
2013-12-22T22:44:48.154715+00:00 app[web.1]: 2013-12-22 22:44:48 [2] [INFO] Shutting down: Master
2013-12-22T22:44:48.154962+00:00 app[web.1]: 2013-12-22 22:44:48 [2] [INFO] Reason: Worker failed to boot.
2013-12-22T22:44:49.467273+00:00 heroku[web.1]: Process exited with status 3
2013-12-22T22:44:49.476498+00:00 heroku[web.1]: State changed from starting to crashed
2013-12-22T22:46:14.111728+00:00 heroku[api]: Scale to web=1 by lukasa@comcast.net
2013-12-22T23:00:11.745429+00:00 heroku[api]: Scale to web=1 by lukasa@comcast.net
2013-12-22T23:02:04.532088+00:00 heroku[api]: Starting process with command `python manage.py syncdb` by lukasa@comcast.net
2013-12-22T23:02:09.382615+00:00 heroku[run.9567]: Awaiting client
2013-12-22T23:02:09.423419+00:00 heroku[run.9567]: Starting process with command `python manage.py syncdb`
2013-12-22T23:02:09.489721+00:00 heroku[run.9567]: State changed from starting to up
2013-12-22T23:02:40.448950+00:00 heroku[run.9567]: State changed from up to complete
2013-12-22T23:02:40.419867+00:00 heroku[run.9567]: Process exited with status 0
2013-12-22T23:02:55.431536+00:00 heroku[api]: Scale to web=1 by lukasa@comcast.net
2013-12-22T23:07:43.620076+00:00 heroku[web.1]: State changed from crashed to starting
2013-12-22T23:07:48.608611+00:00 heroku[web.1]: Starting process with command `gunicorn hellodjango.wsgi`
2013-12-22T23:07:50.407826+00:00 app[web.1]: 2013-12-22 23:07:50 [2] [INFO] Starting gunicorn 18.0
2013-12-22T23:07:50.408800+00:00 app[web.1]: 2013-12-22 23:07:50 [2] [INFO] Listening at: http://0.0.0.0:47545 (2)
2013-12-22T23:07:50.409099+00:00 app[web.1]: 2013-12-22 23:07:50 [2] [INFO] Using worker: sync
2013-12-22T23:07:50.427152+00:00 app[web.1]: 2013-12-22 23:07:50 [7] [INFO] Booting worker with pid: 7
2013-12-22T23:07:50.866294+00:00 heroku[web.1]: State changed from starting to up
2013-12-22T23:07:51.025773+00:00 app[web.1]: Traceback (most recent call last):
2013-12-22T23:07:51.025773+00:00 app[web.1]: 2013-12-22 23:07:51 [7] [ERROR] Exception in worker process:
2013-12-22T23:07:51.025773+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
2013-12-22T23:07:51.025773+00:00 app[web.1]: worker.init_process()
2013-12-22T23:07:51.025773+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
2013-12-22T23:07:51.025773+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2013-12-22T23:07:51.025993+00:00 app[web.1]: return util.import_app(self.app_uri)
2013-12-22T23:07:51.025993+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2013-12-22T23:07:51.025993+00:00 app[web.1]: __import__(module)
2013-12-22T23:07:51.025993+00:00 app[web.1]: File "/app/hellodjango/wsgi.py", line 10, in <module>
2013-12-22T23:07:51.025993+00:00 app[web.1]: from dj_static import Cling
2013-12-22T23:07:51.025993+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/dj_static.py", line 8, in <module>
2013-12-22T23:07:51.025773+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
2013-12-22T23:07:51.025773+00:00 app[web.1]: self.callable = self.load()
2013-12-22T23:07:51.025993+00:00 app[web.1]: from django.contrib.staticfiles.handlers import StaticFilesHandler as DebugHandler
2013-12-22T23:07:51.025773+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
2013-12-22T23:07:51.025773+00:00 app[web.1]: return self.load_wsgiapp()
2013-12-22T23:07:51.025993+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
2013-12-22T23:07:51.025993+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
2013-12-22T23:07:51.026154+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 13, in <module>
2013-12-22T23:07:51.026154+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
2013-12-22T23:07:51.026154+00:00 app[web.1]: template_translatable = ugettext_noop("Index of %(directory)s")
2013-12-22T23:07:51.026154+00:00 app[web.1]: return _trans.gettext_noop(message)
2013-12-22T23:07:51.026154+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
2013-12-22T23:07:51.025993+00:00 app[web.1]: from django.contrib.staticfiles.views import serve
2013-12-22T23:07:51.026154+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 65, in gettext_noop
2013-12-22T23:07:51.026154+00:00 app[web.1]: from django.views import static
2013-12-22T23:07:51.026154+00:00 app[web.1]: if settings.USE_I18N:
2013-12-22T23:07:51.026154+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
2013-12-22T23:07:51.026154+00:00 app[web.1]: self._setup(name)
2013-12-22T23:07:51.026794+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
2013-12-22T23:07:51.026794+00:00 app[web.1]: % (desc, ENVIRONMENT_VARIABLE))
2013-12-22T23:07:51.026794+00:00 app[web.1]: ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
2013-12-22T23:07:51.026794+00:00 app[web.1]: Traceback (most recent call last):
2013-12-22T23:07:51.026794+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
2013-12-22T23:07:51.026794+00:00 app[web.1]: worker.init_process()
2013-12-22T23:07:51.026794+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
2013-12-22T23:07:51.026794+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2013-12-22T23:07:51.026794+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
2013-12-22T23:07:51.026794+00:00 app[web.1]: self.callable = self.load()
2013-12-22T23:07:51.026955+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
2013-12-22T23:07:51.026955+00:00 app[web.1]: return self.load_wsgiapp()
2013-12-22T23:07:51.026955+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2013-12-22T23:07:51.026955+00:00 app[web.1]: return util.import_app(self.app_uri)
2013-12-22T23:07:51.026955+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
2013-12-22T23:07:51.026955+00:00 app[web.1]: __import__(module)
2013-12-22T23:07:51.026955+00:00 app[web.1]: File "/app/hellodjango/wsgi.py", line 10, in <module>
2013-12-22T23:07:51.026955+00:00 app[web.1]: from dj_static import Cling
2013-12-22T23:07:51.026955+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/dj_static.py", line 8, in <module>
2013-12-22T23:07:51.026955+00:00 app[web.1]: from django.contrib.staticfiles.handlers import StaticFilesHandler as DebugHandler
2013-12-22T23:07:51.027325+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
2013-12-22T23:07:51.027325+00:00 app[web.1]: from django.contrib.staticfiles.views import serve
2013-12-22T23:07:51.027325+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 13, in <module>
2013-12-22T23:07:51.027325+00:00 app[web.1]: from django.views import static
2013-12-22T23:07:51.027623+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
2013-12-22T23:07:51.027325+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
2013-12-22T23:07:51.027325+00:00 app[web.1]: template_translatable = ugettext_noop("Index of %(directory)s")
2013-12-22T23:07:51.027325+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 65, in gettext_noop
2013-12-22T23:07:51.027325+00:00 app[web.1]: return _trans.gettext_noop(message)
2013-12-22T23:07:51.027325+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
2013-12-22T23:07:51.027325+00:00 app[web.1]: if settings.USE_I18N:
2013-12-22T23:07:51.027623+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
2013-12-22T23:07:51.027623+00:00 app[web.1]: self._setup(name)
2013-12-22T23:07:51.027623+00:00 app[web.1]: % (desc, ENVIRONMENT_VARIABLE))
2013-12-22T23:07:51.027623+00:00 app[web.1]: ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
2013-12-22T23:07:51.028450+00:00 app[web.1]: 2013-12-22 23:07:51 [7] [INFO] Worker exiting (pid: 7)
2013-12-22T23:07:51.179125+00:00 app[web.1]: 2013-12-22 23:07:51 [2] [INFO] Shutting down: Master
2013-12-22T23:07:51.179239+00:00 app[web.1]: 2013-12-22 23:07:51 [2] [INFO] Reason: Worker failed to boot.
2013-12-22T23:07:52.470088+00:00 heroku[web.1]: Process exited with status 3
2013-12-22T23:07:52.482819+00:00 heroku[web.1]: State changed from up to crashed
我一遍又一遍地执行说明并试图从头开始几次。我在本教程中第一次在本地运行应用程序时没有遇到任何问题,但现在当我测试它时,它不起作用:
(venv)tog:hellodjango lukasolson$ foreman start
18:23:19 web.1 | started with pid 14326
18:23:19 web.1 | 2013-12-22 18:23:19 [14326] [INFO] Starting gunicorn 18.0
18:23:19 web.1 | 2013-12-22 18:23:19 [14326] [INFO] Listening at: http://0.0.0.0:5000 (14326)
18:23:19 web.1 | 2013-12-22 18:23:19 [14326] [INFO] Using worker: sync
18:23:19 web.1 | 2013-12-22 18:23:19 [14330] [INFO] Booting worker with pid: 14330
18:23:20 web.1 | 2013-12-22 18:23:20 [14330] [ERROR] Exception in worker process:
18:23:20 web.1 | Traceback (most recent call last):
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
18:23:20 web.1 | worker.init_process()
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
18:23:20 web.1 | self.wsgi = self.app.wsgi()
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
18:23:20 web.1 | self.callable = self.load()
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
18:23:20 web.1 | return self.load_wsgiapp()
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
18:23:20 web.1 | return util.import_app(self.app_uri)
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
18:23:20 web.1 | __import__(module)
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/hellodjango/wsgi.py", line 10, in <module>
18:23:20 web.1 | from dj_static import Cling
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/dj_static.py", line 8, in <module>
18:23:20 web.1 | from django.contrib.staticfiles.handlers import StaticFilesHandler as DebugHandler
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
18:23:20 web.1 | from django.contrib.staticfiles.views import serve
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 13, in <module>
18:23:20 web.1 | from django.views import static
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
18:23:20 web.1 | template_translatable = ugettext_noop("Index of %(directory)s")
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 65, in gettext_noop
18:23:20 web.1 | return _trans.gettext_noop(message)
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
18:23:20 web.1 | if settings.USE_I18N:
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
18:23:20 web.1 | self._setup(name)
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
18:23:20 web.1 | % (desc, ENVIRONMENT_VARIABLE))
18:23:20 web.1 | ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
18:23:20 web.1 | Traceback (most recent call last):
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
18:23:20 web.1 | worker.init_process()
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
18:23:20 web.1 | self.wsgi = self.app.wsgi()
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
18:23:20 web.1 | self.callable = self.load()
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
18:23:20 web.1 | return self.load_wsgiapp()
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
18:23:20 web.1 | return util.import_app(self.app_uri)
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
18:23:20 web.1 | __import__(module)
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/hellodjango/wsgi.py", line 10, in <module>
18:23:20 web.1 | from dj_static import Cling
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/dj_static.py", line 8, in <module>
18:23:20 web.1 | from django.contrib.staticfiles.handlers import StaticFilesHandler as DebugHandler
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
18:23:20 web.1 | from django.contrib.staticfiles.views import serve
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 13, in <module>
18:23:20 web.1 | from django.views import static
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
18:23:20 web.1 | template_translatable = ugettext_noop("Index of %(directory)s")
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 65, in gettext_noop
18:23:20 web.1 | return _trans.gettext_noop(message)
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
18:23:20 web.1 | if settings.USE_I18N:
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
18:23:20 web.1 | self._setup(name)
18:23:20 web.1 | File "/Users/lukasolson/hellodjango/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
18:23:20 web.1 | % (desc, ENVIRONMENT_VARIABLE))
18:23:20 web.1 | ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
18:23:20 web.1 | 2013-12-22 18:23:20 [14330] [INFO] Worker exiting (pid: 14330)
18:23:20 web.1 | 2013-12-22 18:23:20 [14326] [INFO] Shutting down: Master
18:23:20 web.1 | 2013-12-22 18:23:20 [14326] [INFO] Reason: Worker failed to boot.
18:23:20 web.1 | exited with code 3
18:23:20 system | sending SIGTERM to all processes
SIGTERM received
答案 0 :(得分:3)
让Heroku了解Django设置模块的位置:
heroku config:set DJANGO_SETTINGS_MODULE=your_project.settings
必须将设置模块提交给Git才能在Heroku上使用。