Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52567
| X-Received | by 10.224.13.136 with SMTP id c8mr17464564qaa.0.1376596417022; Thu, 15 Aug 2013 12:53:37 -0700 (PDT) |
|---|---|
| X-Received | by 10.50.109.170 with SMTP id ht10mr175794igb.14.1376596416977; Thu, 15 Aug 2013 12:53:36 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!fx3no2609274qab.0!news-out.google.com!he10ni1979qab.0!nntp.google.com!fx3no2609271qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Thu, 15 Aug 2013 12:53:36 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=208.91.114.4; posting-account=eOkAcwoAAABMG_b1rvHVLOzad-xIYbmk |
| NNTP-Posting-Host | 208.91.114.4 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <6fa2b093-953f-4ffa-8fbb-e01581d18d2f@googlegroups.com> (permalink) |
| Subject | How can I redirect or launch a html file in wsgi coding? |
| From | Hans <hansyin@gmail.com> |
| Injection-Date | Thu, 15 Aug 2013 19:53:37 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.python:52567 |
Show key headers only | View raw
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!!!
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
How can I redirect or launch a html file in wsgi coding? Hans <hansyin@gmail.com> - 2013-08-15 12:53 -0700
csiph-web