2008年01月16日 星期三 08:41
from django.http import HttpResponse import datetime def index(request): now = datetime.datetime.now() html = "It is now %s." % now #html = "hi all " return HttpResponse(html) ×ÜÊDZ¨´í£º 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 -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080116/d0d8894c/attachment.html
2008年01月16日 星期三 08:53
Õâ¶Î´úÂëÎÒÕâÀïÔËÐÐ ÕýÈ·¡£¡£ 2008/1/16, cougar2008 <cougar2008在gmail.com>: > > from django.http import HttpResponse > import datetime > > def index(request): > now = datetime.datetime.now() > html = "It is now %s." % now > #html = "hi all " > return HttpResponse(html) > > ×ÜÊDZ¨´í£º > 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 > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080116/8d974314/attachment.html
2008年01月16日 星期三 08:54
2008/1/16 cougar2008 <cougar2008在gmail.com>: > from django.http import HttpResponse > import datetime > > def index(request): > now = datetime.datetime.now() > html = "It is now %s." % now > #html = "hi all " > return HttpResponse(html) > > ×ÜÊDZ¨´í£º > 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 <>: http://code.google.com/p/ulipad/ meide < >: http://code.google.com/p/meide/ My Blog: http://www.donews.net/limodou -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080116/1fd33781/attachment.htm
2008年01月16日 星期三 09:25
ÔÚshellÖпÉÒÔÔËÐÐ Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> now = datetime.datetime.now() >>> print now 2008-01-16 09:18:18.111000 >>> print datetime.__file__ Traceback (most recent call last): File "", line 1, inAttributeError: 'module' object has no attribute '__file__' ¸Õ²ÅÄã˵Õâ¸öÎÒͻȻÏëµ½£¬djangoÖÐÕâ¸öviewsÎÒÆðµÄÃû×ÖÊÇdatetime.py µ«ÊÇÏÖÔڸijÉmydatetime.py»¹ÊDz»ÐÐ cougar2008 2008-01-16 ·¢¼þÈË£º limodou ·¢ËÍʱ¼ä£º 2008-01-16 08:56:27 ÊÕ¼þÈË£º python-chinese在lists.python.cn ³ËÍ£º Ö÷Ì⣺ Re: [python-chinese]django book ±»datetimeÀý×Ó¸ãÔÎÁË 2008/1/16 cougar2008 <cougar2008在gmail.com>: from django.http import HttpResponse import datetime def index(request): now = datetime.datetime.now() html = "It is now %s." % now #html = "hi all " return HttpResponse(html) ×ÜÊDZ¨´í£º 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 < >: http://code.google.com/p/ulipad/ meide < >: http://code.google.com/p/meide/ My Blog: http://www.donews.net/limodou -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080116/32da62f3/attachment.htm
2008年01月16日 星期三 10:29
¿ÉÒÔÁË£¬¹ûÈ»ÊÇÕâ¸öviewsµÄÃû×Ö¸údatetimeµÄÃû×Ö³åÍ»ÁË£¬£º£©²»¹ýÖ»¸ÄÕâ¸öÃû×Ö»¹²»¹»£¬»¹Òª°ÑÒÔÇ°µÄdatetime.pyŪ³öÀ´µÄdatetime.pycɾ³ý²Å¿ÉÒÔ²»³åÍ» лл£º£© cougar2008 2008-01-16 ·¢¼þÈË£º limodou ·¢ËÍʱ¼ä£º 2008-01-16 08:56:27 ÊÕ¼þÈË£º python-chinese在lists.python.cn ³ËÍ£º Ö÷Ì⣺ Re: [python-chinese]django book ±»datetimeÀý×Ó¸ãÔÎÁË 2008/1/16 cougar2008 <cougar2008在gmail.com>: from django.http import HttpResponse import datetime def index(request): now = datetime.datetime.now() html = "It is now %s." % now #html = "hi all " return HttpResponse(html) ×ÜÊDZ¨´í£º 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 <>: http://code.google.com/p/ulipad/ meide < >: http://code.google.com/p/meide/ My Blog: http://www.donews.net/limodou -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080116/8e3991db/attachment-0001.htm
Zeuux © 2024
京ICP备05028076号