本文介绍了无法在我的电脑中启动django服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过
$ export DJANGO_SETTINGS_MODULE=/Users/masi/Documents/Test/djangobook/ch3.settings
我运行失败
$ django-admin.py runserver
Error: Could not import settings '/Users/masi/Documents/Test/djangobook/ch3.settings' (Is it on sys.path? Does it have syntax errors?): Import by filename is not supported.
如何启动没有错误消息的Django服务器?
推荐答案
您的 $ DJANGO_SETTINGS_MODULE
应该设置为 ch3 .settings
。只需确保 ch3
应用程序在您的 $ PYTHONPATH
中。
Your $DJANGO_SETTINGS_MODULE
should just be set to ch3.settings
. Just make sure that the ch3
app is in your $PYTHONPATH
, too.
例如,如果您的应用程序在 / Users / masi / Documents / Test / djangobook /
中,则设置 $ DJANGO_SETTINGS_MODULE
到 ch3.settings
,并确保您的 $ PYTHONPATH
包含 / users / masi / Documents / Test / djangobook
。
For example, if your app is at /Users/masi/Documents/Test/djangobook/
, then set $DJANGO_SETTINGS_MODULE
to ch3.settings
, and make sure your $PYTHONPATH
includes /Users/masi/Documents/Test/djangobook
.
$ export PYTHONPATH=/Users/masi/Documents/Test/djangobook/
$ export DJANGO_SETTINGS_MODULE=ch3.settings
这篇关于无法在我的电脑中启动django服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!