[英]Could not import settings in zc.buildout
I just setup my project and I'm having a problem getting Django to work. 我只是设置我的项目,而让Django工作时遇到了问题。 Here's my
buildout.cfg
: 这是我的
buildout.cfg
:
[buildout]
parts = python django
develop = .
eggs = myproject
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = ${buildout:eggs}
[django]
recipe = djangorecipe
project = myproject
settings = settings
wsgi = true
fcgi = true
I generated my Django project by running 我通过运行生成了Django项目
$ bin/django startproject myproject src/
The settings file definitely exists and looks fine, but I get the following error: 设置文件肯定存在并且看起来不错,但是出现以下错误:
Error: Could not import settings 'myproject.settings' (Is it on sys.path?): No module named myproject.settings
错误:无法导入设置“ myproject.settings”(在sys.path上吗?):没有名为myproject.settings的模块
Any ideas as to what's going wrong? 关于出什么问题有什么想法吗?
You haven't told your [django]
part which eggs to use. 您尚未告诉
[django]
部分要使用哪些鸡蛋。
You normally have two or three parts in a buildout where you need the very same eggs. 通常,您需要一个完全相同的鸡蛋,而在构建物中有两个或三个部分。 In your case the
[django]
and [python]
part. 在您的情况下,
[django]
和[python]
部分。 Best practice is to add an eggs
option to [buildout]
(as you've done) and to use that in the other relevant parts as eggs = ${buildout:eggs}
. 最佳做法是在
[buildout]
添加一个eggs
选项(已完成操作),并在其他相关部分中使用它,因为eggs = ${buildout:eggs}
。
So... you're only missing that line in your [django]
part. 所以...您只在
[django]
部分中缺少该行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.