python - How do I solve the error of the official canonical "Hello, world" example app of Tornado? -
my python version 2.7.2
python runing uwsgi nginx config is
location /{ uwsgi_pass 127.0.0.1:8888; include uwsgi_params; }
app.py
import tornado.ioloop import tornado.web class mainhandler(tornado.web.requesthandler): def get(self): self.write("hello, world") if __name__ == "__main__": application = tornado.web.application([ (r"/", mainhandler), ]) application.listen(9090) tornado.ioloop.ioloop.instance().start()
then run "i run "uwsgi -s :9090 -w app"
but throw error
[pid: 28719|app: 0|req: 21/21] 118.207.180.64 () {38 vars in 716 bytes} [sun mar 23 22:44:34 2014] / => generated 0 bytes in 0 msecs (http/1.1 500) 0 headers in 0 bytes (0 switches on core 0) attributeerror: application instance has no call method
how solve it?
import tornado.web import tornado.wsgi import wsgiref.simple_server class mainhandler(tornado.web.requesthandler): def get(self): self.write("hello, world") if __name__ == "__main__": application = tornado.wsgi.wsgiapplication([ (r"/", mainhandler), ]) server = wsgiref.simple_server.make_server('', 8888, application) server.serve_forever()
(from official docs)
Comments
Post a Comment