Tornado网络框架入门

Debug posted @ 2011年2月23日 06:46 in 未分类 with tags python tornado , 7393 阅读

Tornado是脸书开源的一个轻量级,高效率,非阻塞的python实现的web框架。

我关注它的使用,也就是开发效率。

使用Tornado要求Python2.5以上版本。 如果用到了tornado.httpclient,还必须安装pycurl。如果是使用Python2.5,需要安装simplejson,更高版本就不用了。

使用Tornado开发,不用安装(当然,你也可以按照说明文档安装), 只需要将源码包解压后放在某一个目录,比如/path/to/tornado, 然后在每个用到Tornado的python文件靠前的位置写上

import sys
sys.path.append('/path/to/tornado')

就可以了。

下面是官方网站提供的一个hello world的例子:

#!/usr/bin/env python
import sys
sys.path.append('/path/to/tornado')
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()

 

  • 无匹配
Avatar_small
bigzhu 说:
2011年2月23日 16:48

Tornado,以速度取胜?

Avatar_small
congzi 说:
2011年3月02日 01:47

@bigzhu: 从他的官方文档来看,是抗并发的能力比较强。

挨踢帮客 说:
2012年2月03日 16:20

官方文档讲得也太简单了...

buy dissertation onl 说:
2019年7月08日 23:58

A debt of gratitude is in order for offer this remarkable article.

carpet cleaning duba 说:
2019年10月05日 17:35

You take golden technologies in enlightening ourselves among the leading house maid services on Dubai. We have always been adept on accomplishing what's needed of much of our customers. Even if a multi-storeyed house hold or a condo, our strong home service personnel are always prepared at ones own doorstep along with a pleasing procedures and competent etiquettes. At Potential Clean House maid Service you follow a intuitive guidance means of our newcomer Home Service personnel. And that’s as to why our maids is the best. Very little stone is without a doubt unturned an important Gem within Power Wash maid expertise.

chat with strangers 说:
2019年10月10日 20:03

I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.

https://www.liberore 说:
2019年10月12日 23:23

Impressive web site, Distinguished feedback that I can tackle. Im moving forward and may apply to my current job as a pet sitter, which is very enjoyable, but I need to additional expand. Regards.

electronic recycling 说:
2019年10月14日 10:07

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...

remembrance sunday a 说:
2019年10月15日 09:42

Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though.

google exam dumps 说:
2019年10月16日 09:25

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...

http://memoriaipms.b 说:
2019年10月17日 01:02

Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though.

medicinal plants 说:
2019年10月19日 09:52

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...

Utility Folding Wago 说:
2019年10月20日 22:26

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...

sunday exercise quot 说:
2019年10月22日 03:39

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...

free chat apps 说:
2019年10月23日 21:44

Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too.

https://star-wars.pl 说:
2019年11月04日 18:09

Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too.

http://www.szortal.c 说:
2019年11月11日 22:26

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future...

Black History Month 说:
2020年1月12日 18:46

Black History Month is a yearly festival of accomplishments by African Americans and a period
for perceiving the central role of blacks in U.S. history.
<a href="https://etandoz.com/black-history-month/">Black History Month 2020</a>

Lee Jackson Day 说:
2020年1月12日 18:50

Lee–Jackson Day is a legitimate occasion celebrated in the Commonwealth of Virginia in the U.S.,
for the birthday events of Confederate commanders Robert E. Lee and Thomas J.
<a href="https://etandoz.com/lee-jackson-day/">Lee Jackson Day</a>

moto x3m 说:
2020年2月07日 14:57

不用安装(当然,你也可以按照说明文档安装), 只需要将源码包解压后放在某一个目录,比如/path/to/tornado, 然后在每个用到Tornado的python文件靠前的位置写上,,,

moto x3m 说:
2020年2月07日 14:58

如果用到了tornado.httpclient,还必须安装pycurl。如果是使用Python2.5,需要安装simplejson,更高版本就不用了。

MAHNOOR 说:
2020年2月21日 02:14

The JNVST Result link will be provided on the official website of JNVST i.e. navodaya.gov.in.  Navodaya 2nd List 2020 Students will be able to download the Navodaya Vidyalaya Result Class 6 by entering their Roll Number and Date of Birth. Once the official authority has declared the result date. We will provide you the information on the Navodaya Result Date in this article.

liam 说:
2020年3月16日 14:45

A debt of gratitude is in order for posting an article regarding this matter here today. The data here is heavenly, and as I am working at es.altoconvertpdftoexcel.com organization, I can utilize this data to finish the entirety of my ventures.

Digital_Zone 说:
2020年4月06日 17:21

This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: Akoestische vloerisolatie

Digital_Zone 说:
2020年4月06日 17:26

Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. Webdesign bureau

Digital_Zone 说:
2020年4月06日 17:50

Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though. Chape

Digital_Zone 说:
2020年4月06日 17:53

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. Webdesign

Digital_Zone 说:
2020年4月06日 17:54

You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. PUR vloerisolatie

Digital_Zone 说:
2020年4月06日 18:03

I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. Geluidsisolatie vloeren

Digital_Zone 说:
2020年4月06日 18:40

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. Webdesign

Digital_Zone 说:
2020年4月06日 18:50

Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!THANKS!!!!!! Chape Antwerpen

Digital_Zone 说:
2020年4月06日 18:50

Very interesting blog. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know. Webdesign

Digital_Zone 说:
2020年4月06日 18:53

Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. Chapewerken Antwerpen

Digital_Zone 说:
2020年4月06日 18:57

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future... Vloerisolatie

Digital_Zone 说:
2020年4月06日 18:58

Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing Webdesign

Digital_Zone 说:
2020年4月06日 19:00

I was surfing net and fortunately came across this site and found very interesting stuff here. Its really fun to read. I enjoyed a lot. Thanks for sharing this wonderful information. Chape vloerverwarming

Digital_Zone 说:
2020年4月06日 19:02

This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. Isolatiechape

Digital_Zone 说:
2020年4月06日 19:05

I admire what you have done here. I like the part where you say you are doing this to give back but I would assume by all the comments that this is working for you as well. Zwembad aanleggen

Digital_Zone 说:
2020年4月06日 19:07

Wow, cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though. PUR vloerisolatie

Digital_Zone 说:
2020年4月06日 19:09

Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely return. <a href="https://www.allnuts.be/nl/ontbijt/havervlokken/d/granola">Granola</a>

Digital_Zone 说:
2020年4月06日 19:09

Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely return. Granola

Digital_Zone 说:
2020年4月06日 19:11

Fantastic blog! Do you have any tips and hints for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m completely overwhelmed .. Any suggestions? Many thanks! Geluidsisolatie vloeren

Digital_Zone 说:
2020年4月06日 19:14

Merely a smiling visitant here to share the love (:, btw outstanding style. Granola kopen

Digital_Zone 说:
2020年4月06日 19:16

Wow! This could be one of the most useful blogs we have ever come across on thesubject. Actually excellent info! I’m also an expert in this topic so I can understand your effort. Isolerende chape

Digital_Zone 说:
2020年4月06日 19:22

Wow, excellent post. I'd like to draft like this too - taking time and real hard work to make a great article. This post has encouraged me to write some posts that I am going to write soon. Granola kopen online

Digital_Zone 说:
2020年4月06日 19:24

Today, I was just browsing along and came upon your blog. Just wanted to say good blog and this article helped me a lot, due to which I have found exactly I was looking. Sneldrogende chape

Digital_Zone 说:
2020年4月06日 19:26

Excellent website! I adore how it is easy on my eyes it is. I am questioning how I might be notified whenever a new post has been made. Looking for more new updates. Have a great day! Biotop zwemvijvers

Digital_Zone 说:
2020年4月06日 19:29

Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. Schuimbeton

Digital_Zone 说:
2020年4月06日 19:31

This article was written by a real thinking writer without a doubt. I agree many of the with the solid points made by the writer. I’ll be back day in and day for further new updates. Bio zwemvijver

Digital_Zone 说:
2020年4月06日 19:41

Keep up the good work; I read few posts on this website, including I consider that your blog is fascinating and has sets of the fantastic piece of information. Thanks for your valuable efforts. Akoestische vloerisolatie

Digital_Zone 说:
2020年4月06日 19:43

This article is an appealing wealth of useful informative that is interesting and well-written. I commend your hard work on this and thank you for this information. I know it very well that if anyone visits your blog, then he/she will surely revisit it again. Eco zwembad

Digital_Zone 说:
2020年4月06日 19:45

Outstanding article! I want people to know just how good this information is in your article. Your views are much like my own concerning this subject. I will visit daily your blog because I know. It may be very beneficial for me. Chapewerken

Digital_Zone 说:
2020年4月06日 19:47

Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. Aanleg zwembad

Digital_Zone 说:
2020年4月06日 19:48

That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more. Biotop zwemvijver

Digital_Zone 说:
2020年4月06日 19:50

I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Aanleg zwembaden

Digital_Zone 说:
2020年4月06日 19:52

Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also PUR chape

Digital_Zone 说:
2020年4月06日 19:54

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. Zwembadaanleg

Digital_Zone 说:
2020年4月06日 19:55

Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. SEO optimalisatie

Digital_Zone 说:
2020年4月06日 19:57

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. Chape

Digital_Zone 说:
2020年4月06日 19:59

Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject. PUR

Digital_Zone 说:
2020年4月06日 20:01

I know your expertise on this. I must say we should have an online discussion on this. Writing only comments will close the discussion straight away! And will restrict the benefits from this information. SEO optimalisatie

Digital_Zone 说:
2020年4月06日 20:03

All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks Chapewerken

Digital_Zone 说:
2020年4月06日 20:05

Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing. SEO expert

Digital_Zone 说:
2020年4月06日 20:07

I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks SEO

Digital_Zone 说:
2020年4月06日 20:10

This is a good post. This post gives truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. Thank you so much. Keep up the good works. Zonnepanelen

Digital_Zone 说:
2020年4月06日 20:11

Please let me know if you’re looking for a article writer for your site. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I’d absolutely love to write some material for your blog in exchange for a link back to mine. Please send me an email if interested. Thank you! SEO optimalisatie

Digital_Zone 说:
2020年4月06日 20:13

I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. Zonnepanelen

Digital_Zone 说:
2020年4月06日 20:15

Only aspire to mention ones content can be as incredible. This clarity with your post is superb and that i may think you’re a guru for this issue. High-quality along with your concur permit me to to seize your current give to keep modified by using approaching blog post. Thanks a lot hundreds of along with you should go on the pleasurable get the job done. Schuimbeton

Digital_Zone 说:
2020年4月06日 20:18

I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. Terrasoverkapping

Digital_Zone 说:
2020年4月06日 20:21

Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! Terrasoverkapping

https://royalcbd.com 说:
2020年4月08日 16:39

Hiya, I’m really glad I have found this information. Today bloggers publish just about gossip and internet stuff and this is really irritating. A good blog with interesting content, that’s what I need. Thanks for making this site, and I will be visiting again. Do you do newsletters? I Cant find it.

ELIZ 说:
2020年4月18日 00:25

<a href="http://www.thekateferg.com/">funny blogger</a>

토토사이트 说:
2020年6月02日 17:28

you have done a great job i hope you will do much batter in the future

ETHENS 说:
2020年7月06日 18:06

Thanks for an interesting blog. What else may I get that sort of info written in such a perfect approach? I have an undertaking that I am just now operating on, and I have been on the lookout for such info. https://www.digitekprinting.com/architectural-drawings


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter