我不想尖叫......
我正在尝试部署我的django项目,而我似乎无法正确设置设置模块。我一直在谷歌上搜索空洞。我之前已经部署了项目(但我仍然是菜鸟)并没有遇到这个问题,所以我无法弄明白。请帮助。
我正在dotcloud上部署。 FWIW我打算在heroku上部署(直到我意识到dotcloud更适合我的项目)并且遇到了同样的错误。我无法弄清楚我做错了什么!
我的设置文件位于:
/Users/<myname>/wheretoeat/wheretoeat/wheretoeat/settings.py
wsgi.py
import os
import sys
#sys.path.append('/Users/<myname>/wheretoeat/wheretoeat/wheretoeat')
from django.core.wsgi import get_wsgi_application
import sys
sys.path.append('/Users/<myname>/wheretoeat/wheretoeat/wheretoeat')
#sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'wheretoeat')))
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
os.environ["DJANGO_SETTINGS_MODULE"] = "wheretoeat.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wheretoeat.settings")
答案 0 :(得分:2)
路径问题有时可能有点棘手。我是否可以通过使用工作项目(可靠部署的东西)建议另一种在dotcloud上启动项目的方法,然后将现有工作逐步移植到此基础项目中。我想邀请你看看我们的django-on-dotcloud食谱:
https://github.com/dotcloud/django-on-dotcloud
使用此项目,您应该能够快速迭代部署的内容,以及可能挂起的一系列问题,这些问题可能与部署有关,也可能不是(我们无法了解整个项目,因此很难确定你遇到的问题。模块位置,包装位置等可能会影响错误。)
使用此功能,您可以了解我们如何设置项目以及设置文件的位置 https://github.com/dotcloud/django-on-dotcloud/blob/master/hellodjango/settings.py
我意识到配方有点过时,并且它不使用最近版本的django引入的新设置文件位置,但是一旦你有一个工作项目,你可以逐步实现它符合你想要推进的任何标准。
如果您仍然遇到问题,请随时在support@dotcloud.com
给我们留言,我们可以帮助您仔细查看可能不适合您的内容。