Django apache mod-python 设置 (vista)
我正在尝试在本地 Vista 计算机(django+apache+mod-python+postgres)上设置我的开发环境,但由于某种原因我无法加载设置。
一切都可以在内置服务器上运行,但不能在 apache 下运行。
这是我的 httpd.conf
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE movies.settings
PythonOption django.root /movies
PythonDebug On
PythonPath "['C:/django'] + sys.path"
</Location>
错误:
ImportError at /
No module named main.urls
Request Method: GET
Request URL: http://localhost/
Exception Type: ImportError
Exception Value:
No module named main.urls
Exception Location:
C:\Python25\lib\site-packages\django\utils\importlib.py in import_module, line 35
Python Executable: C:\Program Files (x86)\Apache Software
Foundation\Apache2.2\bin\httpd.exe
Python Version: 2.5.4
Python Path: ['C:/django', 'C:\\Windows\\system32\\python25.zip',
'C:\\Python25\\Lib', 'C:\\Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', 'C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2', 'C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\bin', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages', 'C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2/_externals']
I am trying to setup my development environment on my local vista machine (django+apache+mod-python+postgres) and for some reason I can't load the settings.
Everything works on the built-in server but not under apache.
Here is my httpd.conf
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE movies.settings
PythonOption django.root /movies
PythonDebug On
PythonPath "['C:/django'] + sys.path"
</Location>
And Error:
ImportError at /
No module named main.urls
Request Method: GET
Request URL: http://localhost/
Exception Type: ImportError
Exception Value:
No module named main.urls
Exception Location:
C:\Python25\lib\site-packages\django\utils\importlib.py in import_module, line 35
Python Executable: C:\Program Files (x86)\Apache Software
Foundation\Apache2.2\bin\httpd.exe
Python Version: 2.5.4
Python Path: ['C:/django', 'C:\\Windows\\system32\\python25.zip',
'C:\\Python25\\Lib', 'C:\\Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', 'C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2', 'C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2\\bin', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages', 'C:\\Program Files (x86)\\Apache Software Foundation\\Apache2.2/_externals']
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的项目代码驻留在哪里? 包含项目的文件夹的父级应该位于 Python 路径上。 假设 main 是你的项目名称,并且它位于 C:\django\projects\main\ 中,你需要在你的 python 路径上有 c:\django\projects\ 。
或者 main.urls 应该是 settings.py 中的 movie.urls 。
Where does your code for your project reside? The parent of the folder that contains your project should be on the Python path. Assuming main is your project name, and it's in C:\django\projects\main\ you'd need to have c:\django\projects\ on your python path.
Either that, or main.urls should be movies.urls in your settings.py.
我知道您几周前问过这个问题,但如果您仍在寻求帮助,您可以尝试 ServerFault。 如果您成功了,请在这里报告!
I know that you asked this question a couple of weeks ago, but if you're still looking for help, you might try ServerFault. If you have success, please report back here!