大家好,感谢您花时间查看我的问题。
我是python的新手。
我只想在我的电脑上创建一个网站。当我使用“django-admin.py”制作项目时,一切都很好。但是当我使用“python manage.py runserver”时,它注意到我:
ImportError: Could not import settings 'test.settings' (Is it on sys.path?): No module named settings
我检查了我的代码,一切正常。manage.py 写道:
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
我的文件夹是这样的:
hua@sun-Rev-1-0:~/hua/mydjango/mysite$ ls
manage.py mysite
项目也对;
hua@sun-Rev-1-0:~/hua/mydjango/mysite$ tree mysite/
mysite/
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
现在我使用 python 来查看我的 os.path:
hua@sun-Rev-1-0:~/hua/mydjango/mysite$ python
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/local/lib/python2.7/dist-packages/distribute-0.6.35-py2.7.egg', '/usr/local/lib/python2.7/dist-packages', '/usr/bin/python2.7', '/home/hua/hua/mydjango/mysite/~share', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg-info', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
我找不到我的错在哪里。