Google App Engine 从日期时间模块抛出此错误
Google App Engine Throws this error from datetime module
File "C:\Users\Savion\Documents\GitHub\petition-app\models\petition.py", line 55, in get_in_effect_petitions
return Petition.gql('WHERE date_added >= :1', datetime.now() - timedelta(14))
AttributeError: 'module' object has no attribute 'now'
我尝试 运行 一个请愿网站,Google App Engine 抛出上述错误。有问题的模块显然是 datetime 模块。有什么解决办法吗?
为了完成问题并得到有效答案,将Brent Washburne的评论复制到答案中:
datetime.datetime.now()
应该可以
File "C:\Users\Savion\Documents\GitHub\petition-app\models\petition.py", line 55, in get_in_effect_petitions
return Petition.gql('WHERE date_added >= :1', datetime.now() - timedelta(14))
AttributeError: 'module' object has no attribute 'now'
我尝试 运行 一个请愿网站,Google App Engine 抛出上述错误。有问题的模块显然是 datetime 模块。有什么解决办法吗?
为了完成问题并得到有效答案,将Brent Washburne的评论复制到答案中:
datetime.datetime.now()
应该可以