Some reminiscences, some memories

Just another boring day
« Zend Framework 1.8.0 带来的变化
广州PHP培训和我的一些想法 »

5

May

Django 1.0.2 mod_python 方式报 TypeError 的解决方法

mikespook 

尝试用 Django 写了一个简单的企业站,部署过程中出了不少问题,不过还好都一一解决了。

“激动不已”的看到了首页,长出一口气:“总不会再出什么其他问题了吧!”随手点了一个内部链接:
—————————————————

TypeError at about

'NoneType' object is not iterable

—————————————————
这回可晕倒了,怎么会有这样一个错误?
接着往下看,发现错误是由于丢失了一个反斜线引起的:

Request Method: GET
Request URL: http://www.i-fang.comabout
Exception Type: TypeError
Exception Value:
'NoneType' object is not iterable
Exception Location: /usr/lib/python2.5/site-packages/django/core/handlers/base.py in get_response, line 77
Python Executable: /usr/bin/python
Python Version: 2.5.2
Python Path: ['/home/www/www.i-fang.com/', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/var/lib/python-support/python2.5']
Server time: Tue, 5 May 2009 10:25:17 +0800

在 Request URL 中域名和路径中间的反斜线丢失了。
是 urls.py 配置的问题?检查、试验……不是!
是 apache 配置的问题?检查、试验……还不是!
所有的内容跟 Django 手册上的完全一致,到底是怎么回事呢?
看到这个邮件列表的内容,才明白,有时手册是不能随便抄的:
—————————————————
Take a look at the django.root PythonOption described here:

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/?from…

Are you using that option? If, yes, remove that option entirely and
try again.
—————————————————

去掉了 apache 配置文件中的“PythonOption django.root /”,重启 apache 后,一切访问正常了。

This entry was posted on Tuesday, May 5th, 2009 at 03:07 and is filed under Python. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

Trackback URI | Comments RSS

 

September 2010
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
27282930  

Recent Comments

  • cbf107 on 我们精通精通
  • mikespook on 我们精通精通
  • == on 我们精通精通
  • 老熊 on 关于Web编程异步模型的白日梦
  • Some reminiscences, some memories » Blog Archive » Akihabara 指南目录 on Akihabara 指南

Tags

乱码 协程 地震 备案 安装 广州 异步 性能 我爱发明 扯淡 招聘 游戏 漏洞 翻译 豆瓣 39.com Adobe akihabara config countdown Demo Flash game engine golang google html5 issue linux Micromedia MongoDB mysql NetBeans nginx NoSQL oracle PHP phpunit Python trac ubuntu xdebug xml xubuntu yield Zend Framework

Blogroll

  • Blog on 27th Floor
  • DBA notes
  • Tim[后端技术]
  • 唐海燕
  • 小众音乐
  • 抚琴居
  • 某人的栖息地
  • 番茄’s Blog
  • 網站製作學習誌
  • 纸老虎传媒

Old friends

  • cbf107

Only

  • 媚惑桃花

OurPNP

  • Biaoest:标的最高级
  • flexsns-官方博客
  • PNP University
  • PNP街坊
  • smallfish 鱼哥的窝子
  • 冰山日志
  • 墙外的光神V5
  • 夜雨's Blog
  • 小冬kobe
  • 小路的奇异世界
  • 广州萌芽工作室
  • 老甘blog
  • 赖勇浩的编程私伙局

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Powered by WordPress
mikespook.com 粤ICP备09065095号