无法导入zc.buildout中的设置

时间:2021-09-12 02:40:35

I just setup my project and I'm having a problem getting Django to work. Here's my buildout.cfg:

我只是设置了我的项目,我遇到了让Django工作的问题。这是我的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?

对于出了什么问题的任何想法?

1 个解决方案

#1


1  

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. 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}.

你通常在一个建筑物中有两个或三个部分需要相同的蛋。在你的情况下[django]和[python]部分。最佳做法是为[buildout]添加一个鸡蛋选项(正如您所做的那样),并在其他相关部分中使用它作为egg = $ {buildout:eggs}。

So... you're only missing that line in your [django] part.

所以...你只是在[django]部分中错过了这一行。

#1


1  

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. 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}.

你通常在一个建筑物中有两个或三个部分需要相同的蛋。在你的情况下[django]和[python]部分。最佳做法是为[buildout]添加一个鸡蛋选项(正如您所做的那样),并在其他相关部分中使用它作为egg = $ {buildout:eggs}。

So... you're only missing that line in your [django] part.

所以...你只是在[django]部分中错过了这一行。