FAQ
*I installed tornado and he is functional, but when I execute the following
script:*


import tornado.ioloop
import tornado.web
import cgi


class MainHandler(tornado.web.
RequestHandler):


form = cgi.FieldStorage() # parse form data
print('Content-type: text/html\n') # hdr plus blank line
print('<title>Reply Page</title>') # html reply page
if not 'user' in form:
print('<h1>Who are you?</h1>')
else:
print('<h1>Hello <i>%s</i>!</h1>' %
cgi.escape(form['user'].value))


application = tornado.web.Application([
(r"/", MainHandler),
])


if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()


*In the terminal have these outputs:*


python test.py
Content-type: text/html


<title>Reply Page</title>
<h1>Who are you?</h1>


*When I call the browser on localhost:8888, the message is this:*


405: Method Not Allowed
*
**Please, can someone have a idea about why the error occurs? and what I
need to do to fix this?*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130417/1ce54d06/attachment-0001.html>

Search Discussions

  • Lele Gaifax at Apr 17, 2013 at 2:43 pm
    Renato Barbosa Pim Pereira <[email protected]>
    writes:

    *I installed tornado and he is functional, but when I execute the following
    script:*

    I think this is the wrong place to ask such a question, more appropriate
    would be http://groups.google.com/group/python-tornado


    Anyway, you defined a MainHandler class *without* any method, and you
    should instead implement at least a "get" or "post" method, as the
    "Hello, world" example on http://www.tornadoweb.org suggests.


    ciao, lele.
    --
    nickname: Lele Gaifax | Quando vivr? di quello che ho pensato ieri
    real: Emanuele Gaifas | comincer? ad aver paura di chi mi copia.
    lele at metapensiero.it | -- Fortunato Depero, 1929.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedApr 17, '13 at 2:01p
activeApr 17, '13 at 2:43p
posts2
users2
websitepython.org

People

Translate

site design / logo © 2023 Grokbase