Sunday, August 3, 2014

How to create simple web site with python?

It is the modern way of doing business and the other major contendor, mod_python, is no longer being maintained.


Django is a great choice if you want a full-fledged production-quality framework but it also comes at the cost of having a lot of overhead and a pretty steep learning curve.

My suggestion is: Tornado!

I have found that Tornado makes it very easy to get up and running quickly. To illustrate here is the "Hello, World" from the Tornado documentation:

import tornado.httpserver
import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

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

if __name__ == "__main__":
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(8888)
    tornado.ioloop.IOLoop.instance().start() 
 
 
In my opinion that speaks for itself.

No comments:

Post a Comment

Dharamart.blogspot.in