django,mod_python配置的问题

pgt112you 2009-04-09 03:37:30
我在apache中配置的虚拟主机如下:
LoadModule python_module modules/mod_python.so
Listen 8888
NameVirtualHost 127.0.0.1:8888
<VirtualHost 127.0.0.1:8888>
DocumentRoot "D:/Python25/Lib/site-packages/django/bin/mysite"
ServerName localhost:8888
<Location "/">
SetHandler python-program
PythonPath "['D:/Python25/Lib/site-packages/django/bin/']+sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonAutoReload Off
PythonDebug Off
</Location>
<Directory />
Order deny,allow
Allow from all
</Directory>
<Location "/media">
SetHandler None
</Location>
</VirtualHost>

运行时,apache中的错误日志中报ImportError: Could not import settings 'mysite.settings' (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings
如果把mysite.settings改为settings,把pythonpath改为D:/Python25/Lib/site-packages/django/bin/mysite
则django会报错No module named mysite.urls。
还请给位高手指点指点,错误原因,怎样改正
...全文
222 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
CDSoftwareWj 2010-09-25
  • 打赏
  • 举报
回复
汗我找到问题解决办法了,楼主也结帖了 -_-||
CDSoftwareWj 2010-09-25
  • 打赏
  • 举报
回复
关注!!

emplateSyntaxError: Caught an exception while rendering: No module named idc\n\nOriginal

这个问题
pgt112you 2009-04-09
  • 打赏
  • 举报
回复
各位高手帮帮忙啊
pgt112you 2009-04-09
  • 打赏
  • 举报
回复
这个问题解决了,就是把PythonPath中bin后面的斜线去掉。
不过现在有出现新问题,就是报错 TemplateSyntaxError: Caught an exception while rendering: No module named idc\n\nOriginal。但是我有idc这个app,就在mysite文件夹下,还请高手继续解答。
pgt112you 2009-04-09
  • 打赏
  • 举报
回复
这个好像好美走到media那里把
sharp_future 2009-04-09
  • 打赏
  • 举报
回复
(r'^medias/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT})
看看代码里面设置url的这句吧 也许知道你的配置要怎么写的。。。
我也是学习中。。。

37,741

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧