mod_python 无法看到我的 Django 项目设置文件
我需要在我的 apache 服务器上部署我的 Django 应用程序,我已将以下内容添加到我的 httpd.conf:
<Location "/dashboard/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/home/firas/project/trunk/dashboard/analytics','/home/firas/project/trunk/dashboard', '/home/firas/project/trunk'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE dashboard.settings
PythonOption django.root /dashboard
PythonDebug On
</Location>
请求我的应用程序时收到以下错误:
mportError: Could not import settings 'settings' (Is it on sys.path? Does it have syntax errors?): No module named settings
我的 settings.py 没有语法错误。
有什么线索吗?
I need to deploy my Django application on my apache server, I've added the following to my httpd.conf:
<Location "/dashboard/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/home/firas/project/trunk/dashboard/analytics','/home/firas/project/trunk/dashboard', '/home/firas/project/trunk'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE dashboard.settings
PythonOption django.root /dashboard
PythonDebug On
</Location>
I am getting the following error when requesting my app:
mportError: Could not import settings 'settings' (Is it on sys.path? Does it have syntax errors?): No module named settings
My settings.py has no syntax errors.
Any clue ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你想让apache看到dashboard.settings,PythonPath应该以“project/trunk”结尾。
您可以使用
或
第一个更好,IMO。
if you want apache to see dashboard.settings, the PythonPath should end at "project/trunk".
You can use either
or
The first one is better, IMO.
不确定您是否仍在寻找答案,但对我来说这是 apache 权限。
修好了。
Not sure if you're still looking for an answer, but for me it was apache permissions.
Fixed it.