간단한 양식에서 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