How can I redirect or launch a html file in wsgi coding?

H

Hans

Hi,

I have code like this:

root@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!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top