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

Heroku can't find my 'settings.py' file

在 heroku 上部署我的 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.

过程文件:

web: gunicorn django_structure.src.django_structure.wsgi

Wsgi.py:

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

项目link: https://github.com/AlfredMulder/Django_work

由于您的 Django 项目不在您的存储库的根目录中,您需要将目录添加到 python 路径:

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