bae部署时遇到settings文件导入问题

pythen
  • 15

项目地址:funtuan.duapp.com
错误提示:
Load module failed
Traceback (most recent call last):

File "/home/bae/app/index.py", line 13, in <module>

application = WSGIApplication(get_wsgi_application())

File "/home/bae/app/deps/django/core/wsgi.py", line 14, in getwsgiapplication

django.setup()

File "/home/bae/app/deps/django/init.py", line 20, in setup

configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)

File "/home/bae/app/deps/django/conf/init.py", line 46, in getattr

self._setup(name)

File "/home/bae/app/deps/django/conf/init.py", line 42, in _setup

self._wrapped = Settings(settings_module)

File "/home/bae/app/deps/django/conf/init.py", line 98, in init

% (self.SETTINGS_MODULE, e)

ImportError: Could not import settings 'tuantuan.settings' (Is it on sys.path? Is there an import error in the settings file?): cannot import name const

回复
阅读 3.5k
2 个回答

如果你是用wsgi启动的话,wsgi里的配置

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "seggings文件夹目录.settings")

application = get_wsgi_application()

WSGI.py的settings的路径写错了。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏