【发布时间】:2014-01-03 16:38:08
【问题描述】:
我正在做 Web 应用程序,但我无法从浏览器中检索日期值。我选择了日期 01/16/2014。
查询字符串如下所示:
?dd=01%2F16%2F2014
我的代码是:
from django.http import HttpResponse, HttpResponseNotFound
import cgi, cgitb
form = cgi.FieldStorage()
def pod_available(request):
dat = form.getvalue('dd')
print dat
return HttpResponse("<html><body>Hello<em>" + str(dat) + "</em></body></html>")
输出:
HelloNone
【问题讨论】:
-
什么叫
pod_available?request是什么类型的对象? -
是它的请求对象。它的 python web 应用程序。
-
但是
cgi脚本没有有request对象,也没有HttpResponse()类。您尚未共享所有代码;request和HttpResponse是从哪里来的?
标签: python django python-2.7 cgi query-string