Re: django book 被datetime例子 搞晕了
"cougar2008" <[email protected]>
| Newsgroups | gmane.comp.python.chinese |
|---|---|
| Message-ID | <[email protected]> |
可以了,果然是这个views的名字跟datetime的名字冲突了,:)不过只改这个名字还不够,还要把以前的datetime.py弄出来的datetime.pyc删除才可以不冲突 谢谢:) cougar2008 2008-01-16 发件人: limodou 发送时间: 2008-01-16 08:56:27 收件人: [email protected] 抄送: 主题: Re: [python-chinese]django book 被datetime例子搞晕了 2008/1/16 cougar2008 <[email protected]>: from django.http import HttpResponse import datetime def index(request): now = datetime.datetime.now() html = "<html><body>It is now %s.</body></html>" % now #html = "hi all " return HttpResponse(html) 总是报错: Request Method:GET Request URL:http://localhost:8000/datetime/ Exception Type:AttributeError Exception Value:'module' object has no attribute 'now' Exception Location:C:\Python25\Lib\site-packages\django\core\handlers\base.py in get_response, line 77 cougar2008 2008-01-16 See if there is a datetime.py file existed in your project path. And you can try to change the code to: def index(request): print datetime.__file__ And see the output in the console, if the module file is what you expected. -- I like python! UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/ meide <<wxPython UI module>>: http://code.google.com/p/meide/ My Blog: http://www.donews.net/limodou _______________________________________________ python-chinese Post: send [email protected] Subscribe: send subscribe to [email protected] Unsubscribe: send unsubscribe to [email protected] Detail Info: http://python.cn/mailman/listinfo/python-chinese