我使用devcenter.heroku.com的入门教程,但我有应用程序错误
heroku日志:
2014-01-19T17:34:43.040183+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
2014-01-19T17:34:43.040183+00:00 app[web.1]: template_translatable = ugettext_noop("Index of %(directory)s")
2014-01-19T17:34:43.040183+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 65, in gettext_noop
2014-01-19T17:34:43.040183+00:00 app[web.1]: return _trans.gettext_noop(message)
2014-01-19T17:34:43.040183+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
2014-01-19T17:34:43.040183+00:00 app[web.1]: if settings.USE_I18N:
2014-01-19T17:34:43.040337+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
2014-01-19T17:34:43.040337+00:00 app[web.1]: self._setup(name)
2014-01-19T17:34:43.040337+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
2014-01-19T17:34:43.040337+00:00 app[web.1]: % (desc, ENVIRONMENT_VARIABLE))
2014-01-19T17:34:43.040337+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.
2014-01-19T17:34:43.040337+00:00 app[web.1]: 2014-01-19 17:34:43 [7] [INFO] Worker exiting (pid: 7)
2014-01-19T17:34:43.172409+00:00 app[web.1]: 2014-01-19 17:34:43 [2] [INFO] Shutting down: Master
2014-01-19T17:34:43.172530+00:00 app[web.1]: 2014-01-19 17:34:43 [2] [INFO] Reason: Worker failed to boot.
2014-01-19T17:34:45.008206+00:00 heroku[web.1]: Process exited with status 3
2014-01-19T17:34:45.021190+00:00 heroku[web.1]: State changed from starting to crashed
2014-01-19T17:34:50.584235+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=obscure-dusk-6015.herokuapp.com request_id=b6ee161c-ba03-469c-90b6-6a66d4fc3a0d fwd="91.205.216.164" dyno= connect= service= status=503 bytes=
2014-01-19T17:35:07.040022+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=obscure-dusk-6015.herokuapp.com request_id=9b0f5bf6-4d1e-44cc-9535-8eaac498c3a2 fwd="91.205.216.164" dyno= connect= service= status=503 bytes=
2014-01-19T17:34:52.715926+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=obscure-dusk-6015.herokuapp.com request_id=9a31257d-4f4d-44cf-ba0e-56c945fc0994 fwd="91.205.216.164" dyno= connect= service= status=503 bytes=
2014-01-19T17:37:13.395872+00:00 heroku[web.1]: State changed from crashed to starting
2014-01-19T17:37:18.773451+00:00 heroku[web.1]: Starting process with command `gunicorn hellodjango.wsgi`
2014-01-19T17:37:20.777009+00:00 app[web.1]: 2014-01-19 17:37:20 [2] [INFO] Starting gunicorn 18.0
2014-01-19T17:37:20.778137+00:00 app[web.1]: 2014-01-19 17:37:20 [2] [INFO] Listening at: http://0.0.0.0:56221 (2)
2014-01-19T17:37:20.778224+00:00 app[web.1]: 2014-01-19 17:37:20 [2] [INFO] Using worker: sync
2014-01-19T17:37:20.800302+00:00 app[web.1]: 2014-01-19 17:37:20 [7] [INFO] Booting worker with pid: 7
2014-01-19T17:37:21.204601+00:00 heroku[web.1]: State changed from starting to up
2014-01-19T17:37:21.257439+00:00 app[web.1]: 2014-01-19 17:37:21 [7] [ERROR] Exception in worker process:
2014-01-19T17:37:21.257439+00:00 app[web.1]: Traceback (most recent call last):
2014-01-19T17:37:21.257439+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
2014-01-19T17:37:21.257439+00:00 app[web.1]: worker.init_process()
2014-01-19T17:37:21.257439+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
2014-01-19T17:37:21.257439+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2014-01-19T17:37:21.257439+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
2014-01-19T17:37:21.257439+00:00 app[web.1]: self.callable = self.load()
2014-01-19T17:37:21.257666+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-01-19T17:37:21.257666+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
2014-01-19T17:37:21.257666+00:00 app[web.1]: from dj_static import Cling
2014-01-19T17:37:21.257666+00:00 app[web.1]: return util.import_app(self.app_uri)
2014-01-19T17:37:21.257666+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/dj_static.py", line 8, in <module>
2014-01-19T17:37:21.257439+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-01-19T17:37:21.257439+00:00 app[web.1]: return self.load_wsgiapp()
2014-01-19T17:37:21.257666+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
2014-01-19T17:37:21.257826+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 65, in gettext_noop
2014-01-19T17:37:21.257666+00:00 app[web.1]: File "/app/hellodjango/wsgi.py", line 18, in <module>
2014-01-19T17:37:21.257826+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 13, in <module>
2014-01-19T17:37:21.257666+00:00 app[web.1]: __import__(module)
2014-01-19T17:37:21.257666+00:00 app[web.1]: from django.contrib.staticfiles.handlers import StaticFilesHandler as DebugHandler
2014-01-19T17:37:21.257826+00:00 app[web.1]: self._setup(name)
2014-01-19T17:37:21.258285+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
2014-01-19T17:37:21.258285+00:00 app[web.1]: % (desc, ENVIRONMENT_VARIABLE))
2014-01-19T17:37:21.258285+00:00 app[web.1]: Traceback (most recent call last):
2014-01-19T17:37:21.257666+00:00 app[web.1]: from django.contrib.staticfiles.views import serve
2014-01-19T17:37:21.257826+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
2014-01-19T17:37:21.257826+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
2014-01-19T17:37:21.257826+00:00 app[web.1]: template_translatable = ugettext_noop("Index of %(directory)s")
2014-01-19T17:37:21.258285+00:00 app[web.1]: worker.init_process()
2014-01-19T17:37:21.258285+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
2014-01-19T17:37:21.257826+00:00 app[web.1]: return _trans.gettext_noop(message)
2014-01-19T17:37:21.257826+00:00 app[web.1]: from django.views import static
2014-01-19T17:37:21.258285+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
2014-01-19T17:37:21.257826+00:00 app[web.1]: if settings.USE_I18N:
2014-01-19T17:37:21.257826+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
2014-01-19T17:37:21.258448+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-01-19T17:37:21.258448+00:00 app[web.1]: return util.import_app(self.app_uri)
2014-01-19T17:37:21.258448+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
2014-01-19T17:37:21.258448+00:00 app[web.1]: __import__(module)
2014-01-19T17:37:21.258448+00:00 app[web.1]: File "/app/hellodjango/wsgi.py", line 18, in <module>
2014-01-19T17:37:21.258285+00:00 app[web.1]: self.callable = self.load()
2014-01-19T17:37:21.258285+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.
2014-01-19T17:37:21.258448+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/dj_static.py", line 8, in <module>
2014-01-19T17:37:21.258448+00:00 app[web.1]: from dj_static import Cling
2014-01-19T17:37:21.258448+00:00 app[web.1]: from django.contrib.staticfiles.handlers import StaticFilesHandler as DebugHandler
2014-01-19T17:37:21.258768+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
2014-01-19T17:37:21.258768+00:00 app[web.1]: from django.contrib.staticfiles.views import serve
2014-01-19T17:37:21.258768+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 13, in <module>
2014-01-19T17:37:21.258768+00:00 app[web.1]: from django.views import static
2014-01-19T17:37:21.258768+00:00 app[web.1]: return _trans.gettext_noop(message)
2014-01-19T17:37:21.258768+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
2014-01-19T17:37:21.258768+00:00 app[web.1]: if settings.USE_I18N:
2014-01-19T17:37:21.258285+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2014-01-19T17:37:21.258285+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
2014-01-19T17:37:21.258943+00:00 app[web.1]: self._setup(name)
2014-01-19T17:37:21.258943+00:00 app[web.1]: 2014-01-19 17:37:21 [7] [INFO] Worker exiting (pid: 7)
2014-01-19T17:37:21.258448+00:00 app[web.1]: return self.load_wsgiapp()
2014-01-19T17:37:21.258448+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-01-19T17:37:21.258768+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
2014-01-19T17:37:21.258768+00:00 app[web.1]: template_translatable = ugettext_noop("Index of %(directory)s")
2014-01-19T17:37:21.258768+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 65, in gettext_noop
2014-01-19T17:37:21.258943+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
2014-01-19T17:37:21.258943+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
2014-01-19T17:37:21.258943+00:00 app[web.1]: % (desc, ENVIRONMENT_VARIABLE))
2014-01-19T17:37:21.258943+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.
2014-01-19T17:37:21.510867+00:00 app[web.1]: 2014-01-19 17:37:21 [2] [INFO] Shutting down: Master
2014-01-19T17:37:21.511026+00:00 app[web.1]: 2014-01-19 17:37:21 [2] [INFO] Reason: Worker failed to boot.
2014-01-19T17:37:22.935959+00:00 heroku[web.1]: State changed from up to crashed
2014-01-19T17:37:22.911866+00:00 heroku[web.1]: Process exited with status 3
2014-01-19T17:37:52.156627+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=obscure-dusk-6015.herokuapp.com request_id=c69b1b21-acba-434a-9093-68660f775543 fwd="91.205.216.164" dyno= connect= service= status=503 bytes=
2014-01-19T17:37:54.663023+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=obscure-dusk-6015.herokuapp.com request_id=31653bd0-e773-45db-bce3-56e63823ba02 fwd="91.205.216.164" dyno= connect= service= status=503 bytes=
2014-01-19T17:37:55.008197+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=obscure-dusk-6015.herokuapp.com request_id=ce33eb76-2a36-4f6e-9027-8a2c53ccabcf fwd="91.205.216.164" dyno= connect= service= status=503 bytes=
2014-01-19T17:37:56.159624+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=obscure-dusk-6015.herokuapp.com request_id=9ef48d51-2586-4de1-8c82-b8e05712260c fwd="91.205.216.164" dyno= connect= service= status=503 bytes=
2014-01-19T17:37:56.486783+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=obscure-dusk-6015.herokuapp.com request_id=d614f261-9d96-4157-9bef-868738d11e17 fwd="91.205.216.164" dyno= connect= service= status=503 bytes=
我该如何解决这个问题?需要帮忙!网络服务器崩溃,我认为问题是枪炮,也许我需要在Procfile中添加一些设置
答案 0 :(得分:0)
错误在这一行:
NotperlyConfigured:请求设置USE_I18N,但设置不是 配置。您必须定义环境变量 DJANGO_SETTINGS_MODULE或在访问之前调用settings.configure() 设置。
换句话说 - 它试图读取USE_I18N是否为True,但在找不到settings.py时会出错。在配置中的某个位置,您没有将DJANGO_SETTINGS_MODULE环境变量定义为settings.py。在内置的wsgi.py文件中,它通常如下所示:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
您是否阅读了有关how to use django with gunicorn的文档?它提到调用项目通常应该如下所示:
gunicorn myproject.wsgi:application