Import error in Django

when i try to give the environment variable "DJANGO_SETTINGS_MODULE" a path, for example, 

DJANGO_SETTINGS_MODULE=mysite_settings,

DJANGO_SETTINGS_MODULE=/home/wgz/my_project/mysite/mysite.settings,

then i type the command "python3 manage.py shell", a "ImportError: No module named '/home/wgz/my_project/" comes up.

after seaching some materials, i got a method by typing "os.environ['DJANGO_SETTINGS_MODULES']='mysite.settings'", then the "ImportError" disappear. of course, this is in the Python environment and import os in advance.

 

posted @ 2016-03-10 23:06  bajunma123  阅读(109)  评论(0编辑  收藏  举报