cundi / blog

push issues as a blog
2 stars 0 forks source link

海盗使用Flask,海军使用Django[翻译] #45

Open cundi opened 8 years ago

cundi commented 8 years ago

原文链接:https://wakatime.com/blog/25-pirates-use-flask-the-navy-uses-django

Pirates use Flask, the Navy uses Django

Apr 21, 2015 Alan Hamlett Engineering

If you're testing out a new idea or getting a product going, you have to choose a web stack to build it on. For Python devs, Flask and Django are the two most popular web framework options. I have experience with both and have chosen one or the other for my myriad of projects and companies. My current product, WakaTime is built with Flask and this choice has helped us achieve our goals of building an API heavy product which enables 27,000+ developers to use and extend.

如果你正想测试一个想法,或者,你必须选择一个web框架来构建它。就Python开发来说,Flask和Django是最流行的两个框架选择。我对两个框架都有使用经验,并为我的无数项目与合作伙伴选择其中一个或者另外一个框架。我的当前产品,WakaTime使用了Flask进行构建,这个选择帮助我们实现了构建一个能够过支持超过27000多开发者的使用和扩展的重量级API。

Having experienced the benefits of choosing the right framework, I created a worksheet to help other devs decide. You can go through it and get a "result" of the best framework to use.

经验有助于选择正确的框架,我创建了一个表来帮助其他的开发做决策。你可以通过阅读这张表得到要使用的最佳框架的“答案”。

Django vs Flask worksheet

Additionally, if you are interested, here are some comparison points for both Django and Flask.

此外,如果你有情趣的话,这里对Django和Flask作出了几点比较。

Differences between Django and Flask Flask和Django之间的区别

Django is older and larger, but Flask has a more active community according to GitHub.

Django老,而且庞大,但是根据Github来说,Flask拥有更为活跃多社区。

Django

Django

Flask

Flask

Many companies use Django and Flask because they save time building the product in the beginning and can scale to handle millions of users as their webites grow.

很多的公司使用Django和Flask,因为在产品开发初期可以节约很多时间,而且随着网站的成长能够处理百万级用户。

Who uses Django?
谁在使用Django?

Who uses Flask?
谁在使用Flask?

Flask serves JSON responses slightly faster than Django.

Flask提供的JSON响应略快于Django。

django-vs-flask-performance

However, they are both insignificant when compared to frameworks in other languages. The reason to use Django or Flask is to increase dev performance, build faster, and have a "fast enough" framework.

不过,在和其他语言的框架进行比较时它们都不重要。选择使用Django或者Flask的理由是增加开发性能,快速构建,而且还拥有“足够快”的框架。

django-vs-flask-performance-insignificant

In conclusion, the reason to use Django or Flask is to save dev time and build faster. You should use your best judgment and this worksheet when deciding which framework is best suited for your use case.

总的来说,使用Django或者Flask的理由是节约开发时间和快速构建。当要选择哪个框架最适合你的应用场景时,你应该根据这张表做出最佳判断。

I would also be happy to chat and help you decide between Django or Flask. Just leave a comment here with your question or jump on the #wakatime channel on irc.freenode.net.

我也乐于和你沟通并帮助你在Django或者Flask之间做出选择。你只需在这里留下你的问题,或者选择irc.freenode.net上的 #wakatime频道。

P.S. Pirates use Flask, the Navy uses Django. WakaTime is a pirate ;)

附笔:海盗使用Flask,海军使用Django。

Update: Emilien Klein found an interesting open-source comparison of Flask and Django.

Update 2: There is a new tool to visually compare open-source projects: Flask vs Django