When I first meet Python web, Tornado 4.x is the first framework I used. It maybe a little hard for a beginner to use coroutine, but the pretty log just hits me.
When I used the WSGI protocol at work, I had to use uwsgi in production. It worked fine but it didn’t give me a convenient experience. I have to write too many settings and debug through the ugly logs.
While Tornado is using non-blocking network I/O and not based on WSGI, it could support to run WSGI server with only one thread.
Core code
1 | import tornado.wsgi |
Why I use Tornado for developing
- Easy to portable WSGI protocol, and you won’t need uwsgi when developing
- Pretty and colorful log output
- Fast reload the server when you edit the code
- Use IPython..
- Support django, bootle, flask.
Github
You could find the example find in this repo:
https://github.com/corvofeng/BlogCode/tree/master/tornado-run
Attention
When you use WSGI protocol, you should never Tornado in the production mode, it’s only support single thread and lacks stability and scalability.