Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52567

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

Newsgroups comp.lang.python
Date 2013-08-15 12:53 -0700
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>

Show all headers | 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


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