我想從簡單的表單捕獲POST數據。如何使用WSGIREF捕獲POST
這是我第一次玩WSGIREF,我似乎無法找到正確的方法來做到這一點。
This is the form:
<form action="test" method="POST">
<input type="text" name="name">
<input type="submit"></form>
而這顯然是缺少正確的信息捕捉後的功能:
從服務器def app(environ, start_response):
"""starts the response for the webserver"""
path = environ[ 'PATH_INFO']
method = environ['REQUEST_METHOD']
if method == 'POST':
if path.startswith('/test'):
start_response('200 OK',[('Content-type', 'text/html')])
return "POST info would go here %s" % post_info
else:
start_response('200 OK', [('Content-type', 'text/html')])
return form()
發生了什麼,而不是正確的行爲? 我只是用一個快速的`paster server`運行這個應用程序,一切似乎都應該如此。 – hao 2009-04-22 04:31:56