If you're playng with Django directly from Python, and not from Django's own manage.py shell, then you need to set the
DJANGO_SETTINGS_MODULE variable before launching Python.
export DJANGO_SETTINGS_MODULE=myproject.settings
For Apache to pick up that variable, you need to set it in httpd.conf as follows:
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
本文介绍了如何正确配置DJANGO_SETTINGS_MODULE环境变量,确保从Python直接运行Django项目时能够正常加载项目的配置。对于使用Apache服务器的情况,也给出了相应的httpd.conf配置示例。
2215

被折叠的 条评论
为什么被折叠?



