Django 1.5b1: executing django-admin.py causes “No module named settings” error

后端 未结 5 1485
离开以前
离开以前 2021-02-07 08:25

I\'ve recently installed Django-1.5b1. My system configuration:

  • OSX 10.8
  • Python 2.7.1
  • Virtualenv 1.7.2

When I call django-

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 09:10

    I've had the same issue as you, and I haven't come up with a good fix aside from prepending my project folder to the PYTHONPATH like this:

    export PYTHONPATH="/absolute/path/to/django/project/folder:$PYTHONPATH"
    

    where my is located at /absolute/path/to/django/project/folder/. I add that export command to the end of my env/bin/activate script so it happens every time I initialize the virtualenv.

    The only difference between our two situations is that I use multiple settings files instead of a single settings.py module.

    You can also call django-admin.py from the folder containing your Django project like so:

    python ~/.virtualenvs/devel/bin/django-admin.py 
    

    so that it recognizes your current working directory as part of the path.

    Hope that makes sense. It's kind of clumsy to explain which makes it hard to search for an answer.

提交回复
热议问题