Tornado is an Open Source Web Server for Python really interesting. It powers the FriendFeed and it is listed in the Facebook Open Source Technology page for Infrastructure.
I tried quickly on my Ubuntu 10.10 Laptop and it is really simple to install and test.
Just open a terminal and type:
- sudo apt-get install python-pycurl
- sudo apt-get install pip
- sudo pip install tornado
- vi hello.py and write an hello world web application like this
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__": application.listen(8888)
Thats it!
Indentation is grammar of the python code.
Thanks hackolite! WordPress changed the source code plugin. Now it’s correct 🙂
thanks, i am a newbie in python