내 django 프로젝트를 heroku에 배포하도록 구성하려고했습니다. 다음과 같은 오류가 발생하는데 실제로 해결 방법을 모르겠습니다.
다음은 전체 역 추적 및 오류입니다.
22:46:15 web.1 | Traceback (most recent call last):
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
22:46:15 web.1 | worker.init_process()
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
22:46:15 web.1 | self.wsgi = self.app.wsgi()
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
22:46:15 web.1 | self.callable = self.load()
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
22:46:15 web.1 | return self.load_wsgiapp()
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
22:46:15 web.1 | return util.import_app(self.app_uri)
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
22:46:15 web.1 | __import__(module)
22:46:15 web.1 | File "/Users/nir/nirla/nirla/wsgi.py", line 12, in <module>
22:46:15 web.1 | from dj_static import Cling
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/dj_static.py", line 7, in <module>
22:46:15 web.1 | from django.contrib.staticfiles.handlers import StaticFilesHandler as DebugHandler
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
22:46:15 web.1 | from django.contrib.staticfiles.views import serve
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 13, in <module>
22:46:15 web.1 | from django.views import static
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/django/views/static.py", line 96, in <module>
22:46:15 web.1 | template_translatable = ugettext_noop("Index of %(directory)s")
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 65, in gettext_noop
22:46:15 web.1 | return _trans.gettext_noop(message)
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
22:46:15 web.1 | if settings.USE_I18N:
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
22:46:15 web.1 | self._setup(name)
22:46:15 web.1 | File "/Users/nir/nirla/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
22:46:15 web.1 | % (desc, ENVIRONMENT_VARIABLE))
22:46:15 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.
다음은 내 wsgi.py 파일입니다.
import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nirla.settings") #nirla is the name of the project
application = Cling(get_wsgi_application())
그리고 관련이있는 경우 내 manage.py 파일 :
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nirla.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
누구든지 여기서 문제를 이해할 수 있습니까? 그렇다면, 무엇이 잘못되었는지 설명 할 수있을 정도로 친절 할 수 있습니까? 감사합니다!
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nirla.settings")
무시됩니까?