我想修一个房间问题。比如这是:
from django.http import HttpResponse
import datetime
def current_datetime(request):
now = datetime.datetime.now()
if now == 2013:
html = "<html><body>It is now %s.</body></html>" % now
return HttpResponse(html)
else:
# giva a response first
urllib.urlopen(message)
# do something
print 'not 2013'
sys.exit(0)
“如何使用”urllib.urlopen文件(message)”而不是“HttpResponse()”?
不要使用HttpResponse(),而是给出响应。
非常感谢。你知道吗
根据我使用Django的经验,通过视图传递请求的每个函数最终都必须返回一个HttpRequest对象。为什么你需要在发送回复之后而不是之前做“某件事”?你知道吗
相关问题 更多 >
编程相关推荐