简体   繁体   中英

Could not import settings in zc.buildout

I just setup my project and I'm having a problem getting Django to work. Here's my 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

$ 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

Any ideas as to what's going wrong?

You haven't told your [django] part which eggs to use.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM