Putting mysiteon sys.path. For flexibility, several pieces ofDjango refer to projects in Python dotted-path notation (e.g.'mysite.polls.models'). In order for this to work, the mysitepackage has to be on sys.path.
We've already seen one example of this: the INSTALLED_APPSsetting is a list of packages in dotted-path notation.
Setting the DJANGO_SETTINGS_MODULEenvironment variable, which givesDjango the path to your settings.pyfile.
Linux 下:
在LINUX下的\ETC目錄中,找到bashrc, 在最後一行中加入”export PYTHONPATH=你要設定的路徑” 重啟,OK!! 更简单的:
就是在运行期临时加上路径,修改 sys.path[0]=路径 就可以 DJANGO_SETTINGS_MODULE在windows下面:
增加环境变量:DJANGO_SETTINGS_MODULE = mysite.settings
这样,接下来你就可以运行http://docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01里面 Playing with the API的例子了