我安装了Django,并且能够仔细检查该模块实际上是否在Python中,但在尝试实现基本命令(如runserver或使用manage.py)时;我收到DJANGO_SETTEINGS_MODULE错误。我已经使用了“设置DJANGO_SETTINGS_MODULE = mysite.settings”作为建议,并将mysite.settings插入到PATH for Python中,因为在线指导我的一些文档。
现在不是未定义,而是说没有这样的模块存在。我在文档中找不到任何其他内容,而是使用我的测试网站名称而不是“mysite”而没有任何更改。有谁知道我错过了什么?我在Python中的Django模块库中找到的就是这段代码。
来自将来导入unicode_literals
from django.utils.version import get_version
VERSION = (1, 11, 5, 'final', 0)
__version__ = get_version(VERSION)
def setup(set_prefix=True):
"""
Configure the settings (this happens as a side effect of accessing the first setting), configure logging and populate the app registry.
Set the thread-local urlresolvers script prefix if `set_prefix` is True.
"""
from django.apps import apps
from django.conf import settings
from django.urls import set_script_prefix
from django.utils.encoding import force_text
from django.utils.log import configure_logging
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
if set_prefix:
set_script_prefix(
'/' if settings.FORCE_SCRIPT_NAME is None else force_text(settings.FORCE_SCRIPT_NAME)
)
apps.populate(settings.INSTALLED_APPS)
答案 0 :(得分:0)
您确定您正确编写了环境变量吗?我问是因为我看到你收到错误DJANGO_SETTEINGS_MODULE(设置有拼写错误)......