Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43760 > unrolled thread
| Started by | Renato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com> |
|---|---|
| First post | 2013-04-17 11:01 -0300 |
| Last post | 2013-04-17 11:01 -0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
Tornado with cgi form Renato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com> - 2013-04-17 11:01 -0300
| From | Renato Barbosa Pim Pereira <renato.barbosa.pim.pereira@gmail.com> |
|---|---|
| Date | 2013-04-17 11:01 -0300 |
| Subject | Tornado with cgi form |
| Message-ID | <mailman.724.1366207448.3114.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
*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?*
Back to top | Article view | comp.lang.python
csiph-web