How can I redirect or launch a html file in wsgi coding?
Hans
hansyin at gmail.com
Thu Aug 15 15:53:36 EDT 2013
Hi,
I have code like this:
root at lin-ser-1:~# cat /usr/local/www/wsgi-scripts/myapp.py
def application(environ, start_response):
import sys
.......
status = '200 OK'
req_method=environ['REQUEST_METHOD']
if req_method == 'POST' :
json_received = environ['wsgi.input'].read()
resp=lib_json_http.process_json(json_received)
output = simplejson.dumps(resp)
elif req_method == 'GET' :
webbrowser.open('http://autotestnet.sourceforge.net/')
return >>>>>This code does not work!!!!
else :
output = "invalid request method"
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
POST works OK, for GET, I hope I can redirect it to a url link, or launch a local html file, how can I do it?
thanks!!!
More information about the Python-list
mailing list