我正在用Django构建一个web应用程序。我选择Django的原因是:

我想使用免费/开源工具。 我喜欢Python,觉得它是一种长期的语言,而对于Ruby,我不确定,而PHP似乎是一个巨大的麻烦。 我正在为一个想法构建一个原型,并没有过多地考虑未来。开发速度是主要因素,而且我已经了解Python。 我知道迁移到谷歌应用程序引擎将更容易,如果我选择这样做在未来。 我听说Django很“不错”。

现在我越来越接近于考虑出版我的作品,我开始担心规模问题。我找到的关于Django伸缩能力的唯一信息是Django团队提供的(我不是说什么要忽略它们,但这显然不是客观的信息…)

我的问题:

目前在Django上构建的“最大”站点是什么?(我主要通过用户流量来衡量规模) Django能每天处理10万名用户,每个用户访问站点几个小时吗? 像Stack Overflow这样的站点可以在Django上运行吗?


当前回答

不知道每天的访问量有多少,但这里有一些大型Django站点的例子:

Disqus.com(来自djangocon的演讲) bitbucket。org(写作) lanyrd.com(源) support网站(源代码) Addons.mozilla.org(源代码)(来自django的谈话) Theonion.com网站 uk评论系统使用Django(来源) instagram pinterest rdio

这里是Quora上高流量Django网站的链接。

其他回答

我相信你正在寻找一个更可靠的答案,但我能想到的最明显的客观验证是谷歌推动Django与它的应用程序引擎框架一起使用。如果有人了解并经常处理可伸缩性,那就是谷歌。据我所知,最大的限制因素似乎是数据库后端,这就是为什么谷歌使用他们自己的…

如果您的站点包含一些静态内容,那么在前面放置一个Varnish服务器将极大地提高您的性能。即使是一个盒子也能轻易产生100 Mbit/s的流量。

注意,对于动态内容,使用像Varnish这样的东西变得更加棘手。

问题是不知道django是否可以伸缩。

正确的方法是理解和知道哪些网络设计模式和工具应该放在django/symfony/rails项目下,以实现良好的扩展性。

一些想法可以是:

多路复用。 反向代理。例如:Nginx,清漆 Memcache会话。例如:Redis 在项目和数据库上进行集群化,以实现负载平衡和容错:例如:Docker 使用第三方存储资产。例子:Amazon S3

希望它能有所帮助。这是我的小石头。

看看这个叫做EveryBlock的微型新闻聚合器。

它完全是用Django编写的。事实上,正是他们开发了Django框架本身。

"What are the largest sites built on Django today?" There isn't any single place that collects information about traffic on Django built sites, so I'll have to take a stab at it using data from various locations. First, we have a list of Django sites on the front page of the main Django project page and then a list of Django built sites at djangosites.org. Going through the lists and picking some that I know have decent traffic we see: Instagram: What Powers Instagram: Hundreds of Instances, Dozens of Technologies. Pinterest: Alexa rank 37 (21.4.2015) and 70 Million users in 2013 Bitbucket: 200TB of Code and 2.500.000 Users Disqus: Serving 400 million people with Python. curse.com: 600k daily visits. tabblo.com: 44k daily visits, see Ned Batchelder's posts Infrastructure for modern web sites. chesspark.com: Alexa rank about 179k. pownce.com (no longer active): alexa rank about 65k. Mike Malone of Pownce, in his EuroDjangoCon presentation on Scaling Django Web Apps says "hundreds of hits per second". This is a very good presentation on how to scale Django, and makes some good points including (current) shortcomings in Django scalability. HP had a site built with Django 1.5: ePrint center. However, as for novemer/2015 the entire website was migrated and this link is just a redirect. This website was a world-wide service attending subscription to Instant Ink and related services HP offered (*). "Can Django deal with 100,000 users daily, each visiting the site for a couple of hours?" Yes, see above. "Could a site like Stack Overflow run on Django?" My gut feeling is yes but, as others answered and Mike Malone mentions in his presentation, database design is critical. Strong proof might also be found at www.cnprog.com if we can find any reliable traffic stats. Anyway, it's not just something that will happen by throwing together a bunch of Django models :)

当然,还有更多感兴趣的网站和博主,但我必须在某个地方停下来!


一篇关于使用Django构建高流量网站michaelmoore.com的博文,将其描述为排名前10,000的网站。Quantcast数据和compete.com数据。


(*)编辑的作者,包括这些引用,曾经在该项目中作为外包开发人员工作。