Heroku找不到我的"settings.py"文件



在部署我的django项目后,将其列入日志:

File "/app/django_structure/src/django_structure/wsgi.py", line 16, in <module>
2018-03-23T12:09:10.575053+00:00 app[web.1]:     application = get_wsgi_application()
2018-03-23T12:09:10.575056+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2018-03-23T12:09:10.575058+00:00 app[web.1]:     django.setup(set_prefix=False)
2018-03-23T12:09:10.575061+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
2018-03-23T12:09:10.575064+00:00 app[web.1]:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2018-03-23T12:09:10.575067+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
2018-03-23T12:09:10.575069+00:00 app[web.1]:     self._setup(name)
2018-03-23T12:09:10.575072+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
2018-03-23T12:09:10.575075+00:00 app[web.1]:     self._wrapped = Settings(settings_module)
2018-03-23T12:09:10.575077+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
2018-03-23T12:09:10.575080+00:00 app[web.1]:     mod = importlib.import_module(self.SETTINGS_MODULE)
2018-03-23T12:09:10.575083+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2018-03-23T12:09:10.575085+00:00 app[web.1]:     return _bootstrap._gcd_import(name[level:], package, level)
2018-03-23T12:09:10.591042+00:00 app[web.1]: ModuleNotFoundError: No module named 'django_structure.settings'

settings.py 在这里包含:django_structure-> src-> django_structure。

procfile:

web: gunicorn django_structure.src.django_structure.wsgi

wsgi.py:

s.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_structure.settings")

项目链接:https://github.com/alfredmulder/django_work

由于您的django项目不在存储库的根部,因此您需要将目录添加到Python路径:

web: gunicorn --pythonpath django_structure/src django_structure.wsgi

最新更新