My python version is 2.7.2
python is runing by uwsgi my 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 I run "I run "uwsgi -s :9090 -w app"
but it throw a error
[pid: 28719|app: 0|req: 21/21] 118.207.180.64 () {38 vars in 716 bytes} [Sun Mar 23 22:44:34 2014] GET / => 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 to solve it?
Tornado is an HTTP server, not a WSGI container (it can be used as a WSGI container, as in x3al's answer, but you lose some of its most interesting features). Use the nginx proxy_pass option instead of uwsgi_pass; a complete example nginx configuration can be found at http://www.tornadoweb.org/en/stable/overview.html#running-tornado-in-production