大家好,感謝您花時間看我的問題。我的django項目不能在我自己的電腦上運行服務器
我是python的新手。
我只是想在我的電腦上啓動一個網站。當我使用「django-admin.py」來製作項目時,所有事情都很好。但是,當我使用「蟒蛇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)
我的文件夾是這樣的:
[email protected]:~/hua/mydjango/mysite$ ls
manage.py mysite
,該項目也是正確的;
[email protected]:~/hua/mydjango/mysite$ tree mysite/
mysite/
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
現在我使用Python看到我os.path中:
[email protected]:~/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']
我找不到在哪裏我的錯。
在你的錯誤跟蹤關於'test.settings',但在你的項目中它是'mysite.settings' – catherine 2013-04-05 10:11:15