Django - Yahoo News Search Results

‘Suspiria’ TV Series in Development; ‘Django’ Also Coming to Small Screen

The Suspiria film remake may be dead, but that doesn’t mean you can keep a coven of witches down. There’s now a Suspiria TV series in development out of Europe, with original writer/director Dario Argento on board as “artistic consultant.” But you’re probably not expecting precisely this plan for the TV version of Argento’s film […] The post ‘Suspiria’ TV Series in Development; ‘Django’ Also ...

‘Django’, ‘Suspiria De Profundis’ Series In Works From Atlantique & Cattleya

France’s Atlantique Productions and Italy’s Cattleya have entered a co-development and co-production agreement to fashion English-language drama series out of Sergio Corbucci’s 1966 Western Django and Thomas De Quincey’s 1845 psychological fantasy essays Suspiria De Profundis . Django , to which Quentin Tarantino paid homage in his 2012 Oscar-winning Django Unchained , is positioned as a re ...

Django Girls make the male-dominated world of IT more accessible to women

An announcement regarding a Django Girls meeting at Hackerspace in the Athens neighborhood of Aghios Eleftherios on Saturday sounded more like a pop group fan club’s get-together than an event addressing a socially and economically challenging issue: the employment of women in today’s dynamic industries of information technology and telecommunications.

Django Django: ‘After our first album, everything went nuts’

Django Django’s first record propelled them from back-room gigs to the top of festival bills. How did they escape second-album syndrome? The last time Django Django talked to the Guardian, towards the end of 2011, they were preparing to release their debut album – a tuneful but experimental mix of psychedelia, folk and the sound of coconut shells being bashed together to make a noise like ...


recent bookmarks tagged Django

Posted on 2 April 2015

Guía definitiva Django 1.8 en Español - Pythonízame

Posted on 31 March 2015

ATP_Performance_Test/ at master · tkopczuk/ATP_Performance_Test

Posted on 31 March 2015

Posted on 28 March 2015

Posted on 24 March 2015

Posted on 24 March 2015

Posted on 24 March 2015

Posted on 24 March 2015

Posted on 24 March 2015

Posted on 24 March 2015

Top Answers About Django (web framework) on Quora

Top Answers About Django (web framework) on Quora

Has Twitter (product) made Ruby on Rails overrated as compared to Django?

"Python is much more powerful than Rails".

First of all, let me start with the obvious: Python is a language, Rails is a web framework. You probably meant that "Python is much more powerful than Ruby", which is the language used to implement Rails. Many beginners make this same mistake.

The first answer: no, it is not. They are cousin languages. Ruby came a couple of years after Python. They have different philosophical roots (Python as ABC-made-right and Ruby as Smalltalk-married-Lisp-cheated-with-Perl). For a many years Python was much faster than Ruby, by an order of magnitude. The gap is negligible, at best, nowadays. Ruby 2.2 is very close to Python 3.4, even surpassing it.

Django and Rails diverged a lot over the years. They actually started differently, Django came from a content-oriented background, Rails came from a post-Dotcom Bubble New Generation of UX-oriented Web Products. This is the Apple-oriented product design and Agile Practioners safe heaven.

Twitter did not "overrate" Rails "compared" to Django. Twitter bet on Rails to make their platform evolve fast with the cutting edge of Web technologies of the time. Quickly pivoting from a microblog platform to a message hub. After they became a big corporation they did what any corporation MUST do: invest in heavier, and much more specific, tech. Which is the reason they stared ADDING (not simply "replacing") stuff such as Scala (which is a much better concurrent language than BOTH Ruby AND Python).

In summary: Python is not "much" more powerful than Ruby. And no, no big company ever regretted using Rails to bootstrap its business to the point of getting those big, fat, Series A investment round.

See Questions On Quora

Posted on 22 July 2015

Does Django lend itself to different type of projects than Rails?

Django lends itself well to projects that already use lots of Python.

Python's main strengths lie in its great support for math and machine-learning. No other language has access to libraries like NumPy, SciPy and the Natural Language Toolkit.

If you're building a web application that will specifically take advantage of these libraries, than using Django will save you the trouble of involving other back-end languages.

Django seems to scale well enough to support moderately high-traffic websites like HackerEarth.

While Rails and Node.js are under more active development, Django is still a solid choice for a Python codebase.

See Questions On Quora

Posted on 29 June 2015

Why would full-stack web developers learn Python or Ruby or (insert other back-end language) instead of JavaScript?

Every good web developer ultimately has to master JavaScript

Here are the most popular technologies for all developers (not just web developers) according to Stack Overflow's 2015 survey of 26,000 developers:

Here are the advantages of other high level scripting languages:


  • has Rails, a good web development framework for small and medium-sized projects.
  • has Sinatra, a light weight tool that can be used for building APIs.
  • has Pry, a first-rate debugging REPL.


  • has great math and science libraries.
  • has Django, a good web development framework for small and medium-sized projects.
  • is useful for Machine Learning.


  • powers Wordpress, which powers a significant portion of all blogs and ecommerce sites.
  • has a lot of quick-and-dirty scripts you can paste directly into a website.
  • has a lot of developers in India and China that you can contract out to help you with your project.

Now that we've discussed the alternatives, let's talk about the lingua franca of the internet:


  • is the only language that runs in all browsers (and the only full stack language).
  • is significantly faster than these other scripting languages (in part because it allows for asynchronous programming).
  • is undergoing major investment of money and talent from companies like Google, Facebook and even Microsoft, and thus is constantly improving.
  • has Node.js, which is used from everything from embedded devices (Internet of Things tech) to major APIs (Netflix).
  • has Angular.js and React.js, which represent the future of single page applications (which represent the future of web development).
  • is the first language that major SDKs and libraries are written for. These are then (maybe eventually) ported over to Ruby, Python and PHP.
  • is used by major databases like MongoDB as a more flexible replacement for SQL. Some of these databases opt to store everything in JSON.
  • pays more than all of these other scripting languages and frameworks, and has more job openings and a faster rate of job opening growth.

There are still plenty of web development programs (college programs, coding bootcamps) that teach high level scripting languages other than JavaScript. Why, indeed.

See Questions On Quora

Posted on 24 May 2015

How do I find a good Django tutorial for beginners?

Alright, here we go:

source: Welcome to Django Djourney

Most of these are playlists:

If you need something like Railscasts or some sort of screencast website for Django, here is one:

The subreddit /r/Django can be very helpful:
Django • /r/django

More Advanced:

Fore more sources check out Matt Makai dot com blogs:
Django - Full Stack Python

  Furthermore, it would be cool to understand this:
Source: Going from web pages to web apps with Python (aka, Django for Designers)

Also, Roberto Rosario on Github (rosarior), have an awesome list of libraries that can help for beginners:
A curated list of awesome Django apps, projects and resources. Inspired by and based on awesome-python.

See Questions On Quora

Posted on 12 February 2015

Should I use PHP, Python (Django) or Ruby (on Rails) to build a dynamic website?

I've developed web applications in all three languages, with various frameworks within each. In my opinion, the choice is really between Python and Ruby.

Say what you will about PHP, and we can debate this for days, but PHP development is significantly slower than that of Ruby/Python. Worse still, this reduction in speed does not offer an improvement in quality as intuition usually tells us. In fact, given sufficient time, the robustness of both languages makes it hard for PHP teams to even achieve a codebase as elegant as one in either one of those languages.

The only time when using PHP is a good decision–again, IMO– is when it offers something that cannot be found in other languages. This is a very short list, as Ruby/Python have very robust lists of features, and offer similar–if not better–performance. However, if you're Facebook and have already hired hundreds of PHP developers, you should stick to it. Or you can hire programming language designers and compiler writers to develop an entire new programming language bearing PHP's syntax just to get out of the mess you put yourself into, which actually happened.

Now, Python or Ruby? Honestly, it doesn't matter; just have your pick. For your run-of-the-mill web application, the differences are virtually non-existent. Both languages have a strong community that follows modern programming paradigms and spits out new libraries like nobody's business. Python offers some impressive scientific computing libraries that Ruby somewhat lacks, but that's about as far as the differences go.

One final note: don't get hung up on Django vs. Rails. You might decide that a microframework like Flask (Python) or Sinatra (Ruby) is robust enough for your application's requirements–as is often the case.

See Questions On Quora

Posted on 21 November 2014

What are the benefits of developing in Node.js versus Python?

I am a Python web developer , who uses Web2py and Tornado for web development , But i will try to be as least bias as possible.

Only real benefits are described by Rustem Kamun

First: You should compare Javascript (V8) vs Python , or Nodejs vs Tornado (or Twisted , or Gevent ) .
V8 VM JIT for javascript made by google is very fast . Its 5.4 times faster than CPython, but it is unfair to compare JIT vs Non-JIT . You should compare it against worthy competitor : PyPy

(Node + V8) vs  (Tornado + PyPy)  (Technical Comparison) :

 Base on Python vs. Node vs. PyPy , lets see how it fairs.
Note: this article is 2 years old and PyPy 2.3 now is a lot faster vs  1.9 it uses back then. So  now it can possibly beat Node.js? i will make a benchmark when i free.
Throughput :
- Node.js ~4100 req/sec
- PyPy/Tornado at ~4100 req/sec

Latency :( i have calculated the graph using gimp: 1 px = 3ms)
- Node.js : 267 ms at 1000 concurrent connections
- PyPy/Tornado : 288 ms

- at 1000 concurrent requests PyPy is stable at 100 MS Standard Deviation Node.js  is at 140 ms. On this case PyPy Tornado is 40% more stable.

So judging from Technical Comparison , There is Almost No REAL Benefit. Claim of Node.js faster than Python is no longer true when PyPy  + Tornado comes to the rescue.

Now lets look at:


Python is clean Clean , and many useful Language features that Javascript does not have.

-True Object Orientation

What above features brings to async programming :
- Very clean code for asyc web development with Coroutines .
- No Callbacks
tornado.gen - Simplify asynchronous code - Tornado 4.1.dev1 documentation

Which is a lot more maintainable than callbacks after callbacks nested with callback style of node.js.

If you already know Python , use PyPy + Tornado , a lot more benificial , productive , and maintainable than using Node.js
Keep javascript for UI Side only.

If you have no choice then use Node.js (if your upper management force it to) .

EDIT: Forgot to mention , this Quora site itself is build using Tornado  , backed by PyPy.

See Questions On Quora

Posted on 12 August 2014

What is the one thing that you wish you knew about Django framework early?

1 thing? ..... How about 11:

text from the article:

I started SocialQ and Math & Pencil just about two years ago. Before I started the companies, I had almost zero web development experience (I’m a data guy) - I started a company learning HTTP, Javascript, AJAX, and Django MVC from scratch. It’s been a wild ride, and our technology stack has since matured to using interesting technologies such as D3.js, Backbone.js, Celery, Mongo, Redis, and a bunch of other stuff - but it didnt happen over night. Looking at the thousands of lines of Django code everyday, I thought it would be worth pointing out things I wish I did differently:

1.Start off with the right directory structure: Starting off, I looked at a few different open-source projects for guidence ([1] and [2]), read a few blogs, but never had good idea on the best way to setup a Django project. Here is what I am currently using:
http://...The apps directory stores all of your customized django apps and thevendor directory stores any apps you do not want to install (or can’t install) using pip or easy_install. The bin directory stores all bash scripts that help you automate your development. I have scripts in here that deploy to staging & production servers, clean up directories, compress assets, backup databases, start/stop celery (locally), etc. The config directory stores all of your configuration files for databases, webservers, munin, celery, supervisor, etc. The media directory stores all static assets such as javascript, css, images, fonts, etc.The template directory stores all the html templates that make your site beautiful. Finally, the static directory is where your compressed assets get dumped into for production. I even created a template for you on github,go star it!

2. Use Celery for asynchronous tasks AND cron jobs (no need to use unix crontab): The first two weeks of development you might not need to shove something into an asynchronous process, but when your non-technical co-founder starts asking why the site is hanging, it’s time to bust out celery (there are other options if you need something more lightweight). Any call that doesn’t need to be synchronous can be queued up and eventually consumed by a celery worker. I recommend using redis as a celery backend (see below) - do not waste your time with RabbitMQ unless you have a good reason to. I use celery for all sorts of tasks from sending out emails to pulling data from the Facebook API. Another intersting use of celery is you can setup periodic tasks to act as a cronjob. When I first started developing SocialQ, I was using UNIX crontab but have since moved everything into celery.

3. Use Gunicorn instead of Apache for your webserver: I know - Apache is battle-tested and all (plus it got a lot of love in The World Is Flat), but two years ago, when I didnt know shit, it was pretty complicated to setup. I just wanted to get a website up and running and forgot about a print statement in my code - whoops— that took down my site with a 500. Apache has a large set configurations that are time consuming to understand.Gunicorn isvery simple and gets the job done. Huge sites are using it too, at scale, so if you just created the next Instagram, you know you’re servers are not going to fail you[1]
http://...Update: This assumes NGINX is managing all incoming requests and serving static content.

4. Don’t be afraid of using MongoDB as your primary data store: There is a lot of hate floating around Hacker News when someone starts talking about MongoDB. I am not gonna sit here and act like it’s the pancea for all web storage problems, but I will tell you what it is good for - fast iteration.South does a nice job with RDBMS migrations, but migrations seem a bit easier in Mongo (see $set and $unset). Two years ago, things were different and Mongo was much less mature — but since then 10gen has added the aggregation framework, full-text search, collection-level locking, etc. I am glad I started with Mongo and it will continue to be my primary datastore.Mongoengine works great with Django, and if you need more control, you can jump down into pymongo. A lot of other big companies love MongoDBtoo:

5. Use named URLs, reverse, and the url template tag: This one seems dumb, I know, but man - I wish I knew about reverse when I started. Do yourself a favor and name all of your urls, and only refer to them by name in both templates using the url template tag and using reverse in the backend. It will potentially save you a lot of time in the future because nothing will be hard-coded and one url change will not break the site and unit tests.

6. Get your file right: There has been a lot of discussion about what is the right approach to Django settings. You can read about these discussions here and here. Personally, I like adding to my top-level directory and then importing it at the bottom of my settings file, overriding any variables declared above it in My method works well for me, but you should definitely figure out how do separate development, staging, and production level settings.

7. Use supervisor for process monitoring: If you havnt heard of supervisor yet, and you are deploying to a unix-based machine, go here and start reading. Supervisor will control all of your processes for you. You just need to add a separate configuration file for each process. If the process goes down, supervisor will bring it back up. Examples of supervisor processes: Celery-beat, celery, gunicorn, statds, mongodb etc.

8. Pick the right AJAX/JSON mechanism: Unless you want to do a full page reload with every HTTP request (which is completely ok, but SO 1995) you are going to want to send some data to the server using AJAX. The problem you will quickly hit is Django does not have a built in JSON HTTP response, so you are going to have to either man up and roll your own (good luck) or copy someone else smarter than you (this is what I did). Here is adecorator that works great, and this response is superb also:

9. Use Redis - because it will eventually be your best friend: As I suggested above, at the beginning, Redis can just be used to queue yourcelery jobs. Later on, when the time comes you can store your sessions to redis. Then, you can use redis as a cache. Then you can use redis for auto-completion. Then …. I rest my case - just use Redis!

10.Use munin and statds for process monitoring. Munin lets you make nice graphs of almost anything, statds lets you time or count (increment) anything. Add these to your project as soon as possible and monitor everything. You can easily write your own munin plugins in Python to monitor just about everything.

11.Use jammit for static asset compression. Jammit came out ofdocumentcloud, and even though it was built for Ruby on Rails you can do something like this and use it for Django pretty easily. One of the things I like about it is you can setup different named configurations for javascript and css for different sections of your site (dashboard, non-authenticated, standard). It supports lots of other stuff too.

See Questions On Quora

Posted on 8 July 2014

Would Pinterest consider Flask in place of Django if it were starting today?

I'm sure we would at least consider Flask, given that we do use it now for our API, which powers more than half the traffic that Pinterest serves. It's very lightweight and easy to set up and scales reasonably well.

Plus, one of our first key architectural decisions was to split out a database service to handle all reads/writes to MySQL, which if repeated would make the database management abstractions in the choice of web framework much less of a consideration.

For what it's worth, we hardly use Django for much in our web stack now, besides the middleware (authentication, logging, etc.). Aside from migrating off the ORM years ago, we've written our own routing and generally don't use handlers in the Django pattern. So it hasn't really passed the test of time and a growing codebase and engineering team.

See Questions On Quora

Posted on 17 February 2014

What are the advantages of using Python for building a website over using other languages like Perl, Java, ASP and Ruby on Rails?

Unlike Perl, Python is extremely clean and easy to read, encouraging good structure. As a result, Python code is easy to maintain, even by developers who were not involved with writing the original code.

Unlike Java, Python is much more concise, expressive and to-the-point. This makes it considerably faster to develop good quality software.

ASP and RubyOnRails are NOT languages in their own right. They are web development frameworks, and as such should not be compared directly with Python, but instead with a Python-based web framework like Django.

Unlike ASP, Django is not tied to any Microsoft operating system, platform, or technology - it is a much more open framework, with fantastic documentation, easy to learn and supported by a great community.

The only thing left to compare is RubyOnRails vs. Django. Here, the differences are much finer, because the two frameworks are very similar and have very similar strengths. There are plenty of articles on the Internet comparing the two, so I will not delve into that analysis here.

See Questions On Quora

Posted on 28 January 2014

What are the benefits of developing in Node.js versus Python?

It depends on the problem. If you think that your problem should be implemented on asynchronous I/O: so compare not just python vs nodejs, but (twisted, tornado, ...) vs nodejs. Python does not support from scratch asynchronous I/O, like nodejs, however, since python supports generators (coroutines), asynchronous programming in python is much simpler and concise. NodeJS programming is based on event/callback(continuation passing) style which makes your code growth faster and makes your code harder to debug and maintain. I suggest you Tornado(Python) framework: it is very easy to start, it has good support, it proofs his stability on a lot of projects.

With the emergence of promises (Promises/A - CommonJS Spec Wiki) the coding style is very comparable to python coroutines (futures). So the main set of points that must be thoroughly investigated are:
  1. Python stack or JS stack i.e. if you already using python for some part of your system, no need to load your team with other languages. It doubles maintenance job.
  2. Requirements to performance (e.g. N thousands simultaneous connections). You can look through benchmark results (gevent vs nodejs vs scala vs ...)
  3. Community and maintenance of the projects (For example, Python tornado requires a lot of ground coding. It comes with basic tools and asynchronous server i.e. very often you need to implement asyncronous drivers by yourself for memcached or for postgres. NodeJS has much more contribution and it is easy to learn).
  4. Area of development (Twisted suits for network programming, nodejs is good for multiplayer games)

See Questions On Quora

Posted on 8 January 2014

Is it better to create your own framework, or would it be best to just use Django or something like that?

You should absolutely use an existing framework such as Django rather than writing your own.

Doing so will let you work faster, and take advantage of code written by others. This will dramatically increase your chances of building a successful website as opposed to spending months tinkering with your own framework rather than solving the unique problems that make your website interesting.

If your site is a big success, you'll be able to scale Django to meet your demands. There are plenty of huge sites running on Django - such as Pinterest, Instagram, Eventbrite and Disqus. They all end up having their own customisations for scale but that doesn't mean that they didn't benefit enormously from using an existing framework rather thank rolling their own from scratch.

Concentrate on getting to a point where your site is so successful that it causes problems. Those are good problems to have!

See Questions On Quora

Posted on 1 November 2013

What are the best ways to improve Django performance?

  • Cache your views when possible using Django's internal cache Django’s cache framework.
  • Cache your queries using django-cacheops by now is the best I have used and it's compatible with Django 1.5 (it uses Redis). *
  • Use djcelery with Celery: Distributed Task Queue for every task that can be delayed (i.e. sending an activation email).
  • In production use nginx as reverse proxy with Deploying Gunicorn I am using Gunicorn after running some benchmarks with UWSGI, Gunicorn won and it is really easy to setup compared to UWSGI!
  • Use Gunicorn with greenlet/gevent (this requires libevent installed on your system).
  • Stay away from the dbms whenever possible, one thing I learned using Django is that the main thing that slows really down your application is the database. Scaling at application level really helps.
  • If you are going to use Postgresql use Autocommit = True in your settings and keep in mind that the upcoming version of Django (1.6) will support connection pooling with psql.
  • You can debug your application and see what is slowing down the app with django-debug-toolbar one of the best tool I've ever used. You can see SQL Queries in every view.

* I saw major improvements using johnny-cache instead of cacheops, by the way this is strictly a personal choice. You should try and see what is better suited for your app.

See Questions On Quora

Posted on 28 September 2013

How scalable is Django?

Django scales in exactly the same way as PHP or Rails or any other stateless shared-nothing web technology: you ensure that the web nodes (running your Django code) are independent from your persistence layer (database, caching, session storage etc) and scale then independently.

Since the Django web nodes have no stored state, they scale horizontally - just fire up more of then when you need them. Being able to do this is the essence of good scalability.

In my experience Java applications are more likely than Python applications to have stateful web servers which fail to scale horizontally, hence the more common need for things like load balances that support sticky sessions in the Java world.

That's not to say you can't have stateless Java web application servers that scale horizontally if you set out to do so - you just need to be disciplined about it.

Performance is another matter entirely: Java is generally faster than Python, and some aspects of Django (such as the template language) are actually quite slow. But performance and scalability are not the same thing.

See Questions On Quora

Posted on 21 August 2013

What are the django open source apps that Disqus is using?

We wrote a lot of open source components on top of Django at Disqus, the two most prominent being Sentry and Gargoyle.

On top of that, we contributed to or maintained many others:

- Debug Toolbar
- Devserver
- Various testing libraries
- Various database utilities

When I left, there were more than 100 external dependencies (from PyPi) that the web backend relied on.

You might also take a look at

See Questions On Quora

Posted on 19 August 2013

What is the Django programming language?

I suppose that we should start by clarifying that Django is not a programming language ;). It is a web framework written in the Python programming language.

In very non-technical terms: Django is a kit that provides the the basic infrastructure for a website (specifically, it handles the backend). It is a system for you to organize data and web pages, and to serve them appropriately depending on the situation (e.g. what page the user is trying to visit, who the user is, what information is in your database, etc.).

Programmers like to use frameworks like Django because they make it easier to build projects. As a result, development time tends to be much faster both initially and in the long run. You don't have to reinvent the wheel at the beginning, and the framework provides some well-thought out design patterns for you to follow as your project grows in size.

Django was originally developed in 2003 by a team in the web department at the Lawrence Journal-World (a daily newspaper in Lawrence, Kansas). It has since become an open-source project that thousands of people across the globe have contributed to.

According to the Django FAQs, the name comes from Django Reinhardt, a jazz guitarist who was active from the 1930's through the early 1950's. I guess the creators were big fans.
Django Reinhardt - Honeysuckle Rose

See Questions On Quora

Posted on 18 August 2013

What are some good beginner level open source projects online that I can involve myself in?

First of all, there are no "beginner level open source projects".
If you are new to open source, I suggest that you watch Leveraging Open Source - Everything You Wanted to Know About Open Source that Nobody Told You (including getting paid to do it). Then, read The Architecture of Open Source Applications and pick the ones you would love to code on. All open source projects have bug tracking systems. Work your way through it and pick up simple tasks. It actually works much better if you use the very same open source software which you code/work on. That way, you get to wear the tester hat too. Remember that open source contribution is not just about the coding part alone. It encompasses a whole ecosystem of testing, people management, project management, documentation and a fair bit of evangelism. And don't forget to have a lot of fun and learning all along the ride.

See Questions On Quora

Posted on 23 July 2013

Why is there a recent trend away from PHP towards Python and Ruby on Rails?

At least where I'm at in my career path, the main reasons can be summed up best by the following statement:

It's easier to go wrong with PHP

That's not an inherent problem, it's just the way it has panned out.

The problems you can commonly make with PHP stem from its lineage as a simple web scripting language rather than a programming language proper.  These are not the kind of things you are going to get bit by at the typical webapp or website scale, serving simple dynamic content via apache/php/mysql.  These are the kinds of problems you only get to appreciate after you've worked to scale, where your threaded networking model is immediately apparent as a bottleneck.  You immediately appreciate the modular namespacing and alternative networking flexibility of other languages after you make the switch.

You can make very elegant and highly scalable code in PHP.  There are many, many examples where I work presently.  It's just that you only learn these techniques after you've been bitten, and by then, if you have the option to make the switch to something new, you are pretty sorely tempted just on the merits of the alternative.  You don't come into web development understanding the value of organization and namespacing, you learn it over time.  I made the switch to python years ago, and only periodically looked back when professional needs (clients or jobs!) demanded.

PHP has tremendous mindshare.  It deserves the respect it's gotten as most developers introduction to web programming.  It's team is also to be commended for their recent efforts to modernize its structure vs Ruby or Python since the release of v5.  However, none of this changes its typical use-case - a front-facing webapp answering HTTP requests most likely tied to Apache or Nginx.

Consider some other complex problem domains - there are no machine-learning libraries for PHP, for example.  Consider writing an in memory inverted index, something like what Sphinx search uses for example, in PHP... there are so many uses when you scale out that PHP is not well suited to: Asynchronous networking a la Nodejs or Tornado?  Graceful interface design between CLI, web, and GUI?  Special network protocol programming (socketio, amqp, etc)?    Most PHP devs would argue that they are not interested in these problem domains and that PHP is not the tool, and they are right, at least until their professional environment demands it.

So, succinctly, to answer why the companies you are looking at are switching, it's only because they grew larger, and their needs diversified greatly.  Over time, they needed to trade up.

See Questions On Quora

Posted on 7 March 2013

What are some of the coolest, good-to-know Django tricks/shortcuts?

  1. For model inheritance, it's best to stick with abstract base classes.
  2. If you need to secure a site, use django-secure.
  3. Use custom template tags as little as possible. They slow down down your site. 
  4. Never, ever autoload template tags. It's a nasty bottleneck and causes maintenance issues. If you do this you are shooting yourself in the foot. Explicitly load them per template.
  5. Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants. This will cause Django/Python to load the libraries on application startup and matches PEP 8 -- Style Guide for Python Code. Never, ever place imports into functions or methods thinking that it will speed up your code. It has almost nothing to do with 'lazy loading', it is a developer created bottleneck.

See Questions On Quora

Posted on 23 January 2013

How do you organize multiple projects in a codebase with shared logic?


At Spotify, we have learned, through maintenance pains equal to the heat or a thousand burning suns, that decoupling is the way to go. Basically, decouple until it hurts.

We found that the more stuff you build into a thingamabob, the more brittle it is. Partly just because more code inevitably means more bugs and more hairy maintenance, and partly because the more responsibilities a system has, the more other systems depend on it. This, in turn means that the service will fail more because it's under greater stress from many other apps (which, as a bonus, will fail with it).

The Spotify backend (which is Python to a very large degree, by the way) consists of about 100 different services. They are all very, very simple and are stricly focused on doing one thing well. Most of them are pretty autonomous, meaning that they depend on few other services, and when they do, they assume that the other services get slow and/or go down from time to time.

Note that these are separate services. They have their own code base and their own databases. For instance, the playlist service is completely separated from the user service and the music storage. Sharing a single database is NOT a good idea - it quickly turns into a massive, unmaintainable horrible thing that must not fail, but does, all the time. :) I have observed this "master database" phenomena first-hand in other companies, and it's NOT fun and happens REALLY fast. 

These services talk to eachother using a propietary protocol, but used to be done in HTTP.  HTTP will do fine for most services, the reason we no longer use HTTP at Spotify is because our load situation is extreme - 20 million users streaming music is crazyhat.

Spotify makes incredibly extensive use of git submodules, which is definitely a workable solution. However, I'm personally not a fan. Git submodules are not designed to be a package manager, and if you can, use actual package managers instead, such as pip or easy_install for Python, npm for node.js or gem for Ruby. It will save you a lot of pain to have sematically versioned packages in place instead of messing with git submodules. To set up a private package server, I recommend Gemfury.

We do, actually use a single repository for all this, and git seems to handle this just nicely. If you use Github, you might as well use separate repositories, but it's very tricky to setup without.

Edit: More fun reading about the Spotify backend can be found in this answer: What is Spotify's architecture?

See Questions On Quora

Posted on 10 December 2012

Do I use PHP, Node.JS, or Django for RESTful service?

I don't have much PHP or Django experience, but maybe I can help frame this question a little differently.

The choice of a language/platform should be about a few factors, some of which have been called out here, but by looking at these factors the right answer usually becomes pretty clear.

First, you can build a robust solution with any of these technologies.  But they aren't all designed for the same things.

The web has gone through some specific stages of evolution and the "hot" technologies have been a reflection of that.  The early programmable web was focused on rendering HTML with some amount of dynamic formatting or content: PHP was designed to handle this scenario, and it does it very well.  Later websites were rendered as highly dynamic and driven primarily by a data model backed by something like MySQL.  Ruby on Rails was designed to handle this scenario, and it does it very well.  And the more recent trend of websites being highly dynamic both in terms of render and in update (in other words AJAX/Single Page) where parts of a page will regularly make server calls and update independently from main page, with lots of small requests going back at high frequency.  Node.js was designed to handle this, and it's not as awesome at rendering HTML, though it works.

With that in mind, here are the other considerations that come to mind:

  • Organizational Climate:  Is your company one that is conservative on technology decisions or one that allows using newer, emerging technologies?
  • Hiring/Skills:  What is the skill-base of your workforce?  How hard is it to find people that can manage working on a given technology?  Are they flexible and quick to pick things up, or are they narrowly focused on what they already know?
  • Specific Functionality:  Does the stack in question support the systems you need to integrate with - MySQL, MSSQL, AMQP, etc.  Will you have to write support for these and/or maintain it yourself?  Are there Apache features you need, Nginx, etc?
  • Performance:  What type of load do you expect your system to experience and how does it scale under this load?  Node, in particular has a very horizontal scaling model due to it's threading (er, non-threading) characteristics.  It's not too bad with cluster, but it doesn't do multi-proc, for example.
  • Setup and management:  I'm not too familiar with the others but one of the nice things about node is that you don't need a separate web server.  For many scenarios this is super handy for deployment and management.
  • Tooling:  Older and more widely used systems tend to have better tooling across the lifecycle: CI servers, deployment scripts, compilers/optimizers, debuggers, etc.  The less of these you have, the more experienced and skilled you need you developers to be.

If it's true you're "routinely building simple RESTful web services", my experience is that node + restify handles this very elegantly, but it's equally doable in any of the technologies listed.

See Questions On Quora

Posted on 4 November 2012

Why is there a recent trend away from PHP towards Python and Ruby on Rails?

PHP was the first open source language designed for the web and reached maturity around 1999 with the release of PHP4.  Before PHP there was only perl (free, but a general purpose scripting language, kind of hard to learn) and ASP (which was not free and required an enterprise-level budget to run.)  So PHP had a head start of about 6 years over Ruby andy Python.  (These languages existed since the mid 1990's but had no web frameworks written for them).

Despite PHP's many shortcomings (lack of true object orientation, weak exception handling, no lambdas, and as others have mentioned, being essentially a huge flat namespace of inconsistently-named functions) it won by its ubiquity.  It was free and even the cheapest commodity web hosting providers were offering PHP by 2002 or 2003, so it had a full generation in Internet years to establish itself as the common language for open source developers. 

The emergence of Rails in 2005 began to change that but it took a few years for Rails to gain mainstream acceptance.  Python followed suit with the development of the Django framework, on the same MVC pattern as Rails. 

Services like Heroku were essential in getting Ruby to the mainstream - you no longer needed to have dedicated servers or know how to compile source code to run a Ruby server - you essentially had the same consumer-level pricing for running Ruby apps that you had with PHP. 

Ruby and Python are overtaking PHP because developers tend to favor the languages - they have better abstractions and allow programmers to be more productive.  Also, the ubiquity of PHP worked against it a little because it meant that less skilled programmers could contribute code and the quality of code in PHP projects is generally of a much lower quality as a result (see WordPress plugins for example) while the Ruby and Python communities have focused on developing better coding practices like Test Driven Development.  As a result, people who use Ruby and Python are perceived as "better" programmers, and more desirable hires.  New technology-focused companies are thus more likely to start projects in Ruby and Python because of the perceived higher quality of developers, even though for most web applications, an experienced team ("experienced" being the key) using Symfony or Cake can be just as productive as a team using Rails or Django

There's always going to be a fringe language X that's favored by hackers and academics, but has no obvious business application and thus stays obscure, only to seemingly come out of nowhere years after its invention when the critical mixture of a user need and practical libraries is achieved.  Today it might be Haskell or OCAML or Scala.  It's been LISP for about 50 years now.

See Questions On Quora

Posted on 27 October 2012

Why is there a recent trend away from PHP towards Python and Ruby on Rails?

Aside from the intrinsic qualities of Ruby or Python over PHP, there are some logistical ones.

The mindshare of using Ruby or Python has increased.  Frameworks like Rails and Django have grown in popularity.  It means there's more engineers who know how to use Ruby or Python.

There was a time when launching a site in Ruby or Python would mean a bit of a risk in available engineering talent, but now Ruby and Python are fairly easy to use languages, and these days it's almost easier to deploy Ruby or Python rather than adding mod_php to Apache.

See Questions On Quora

Posted on 14 October 2012

What are good ways to learn Python and Django?

In addition to Navin Kabra's great answer, after step #5, I'd recommend reading the source code of some good django projects.
I've listed a few here(not necessarily in any order): - An intelligent news reader built in Django - Stackoverflow style QA - documentation management system - reskinned Admin for Django

This list is by no means complete. Some excellent Django projects get released now and then. As a good exercise, try to do a full fledged product in Django in a short span of time,  like 66 hours.  This gives you
1. a very good insight into the true spirit of Django, i.e. rapid and iterative deployment.
2. a chance to learn in the battlefield[1]

Django deployment is fairly well documented at

To answer your question on scalability, it has more to do with your architectural decisions than your choice of language or web framework.[2]


See Questions On Quora

Posted on 10 October 2012

AWS versus GAE for python/Django apps?

AWS almost all the way. Why?

  • Free Tier: AWS costs you arguably a little more money at the low end, but you have tighter control over what you do. Many PaaS such as Heroku or dotCloud have free options so you don't have to pay. Plus, you don't have to worry about your service vendor changing prices on you. Cause if they do you can move to another service - say OpenStack on Redhat servers. (Winner: AWS)
  • Deployment headaches: GAE has great deployment compared to bare metal AWS servers. But if you factor in a PaaS like Heroku or dotCloud or Gondor or OpenStack, then all those problems are mitigated. (Winner: EVEN)
  • Scalability: GAE wins here because it does auto-scale nicely. On the AWS side of things, good architecture or Modern PaaS can mitigate that but if you don't have the right code in place you can get hammered without knowing about it. However, if you do have the right pieces in place, then AWS is just as good - and probably cheaper.  (Winner: GAE by a small margin)
  • Use of Open Source tools on machines: AWS wins because for GAE dependency management for Python or Java relies on doing things the Google way. In Python terms, that means you aren't using pip/virtualenv/buildout and in Java I guess you aren't doing Maven or whatever is done now. Which means you get access to tens of thousands of libraries and tools, and aren't cutting/pasting them into your project. Which, of course, is a problem when you want to do simple project updates. (Winner: AWS)
  • Available databases (SQL, NoSQL): AWS wins because it's database agnostic. While BigTable is very powerful, it's not a relational database (still useful) and it's not a key/value store. One database type for all solutions is not the right way to do things. That said, I like BigTable for things it's meant to do, but you simply lose the variability of AWS. (Winner: AWS)
  • Other factor - Avoidance of vendor lock-in: I mentioned this before but vendor lockin is a horrible thing. What if Google changes terms? Or goes through a period of unreliability? Google is notoriously unresponsive when it counts, which means unless you have personal connections at google, who can you really call? That said, AWS suffers the same problem, but... you can more easily move your stuff over to other servers running similar components. (Winner: AWS)

In my review, the victory goes to AWS.

See Questions On Quora

Posted on 6 September 2012

How do large scale Django implementors use NoSQL-type storage strategies?

NoSQL isn't the answer. Stick with a real database.

We use Memcache, Redis, and Cassandra (in that order), all for data which can easily be rebuilt. Postgres is (and will always be) our primary storage engine.

You'd be surprised how far (very) that you can scale with a single Postgres cluster. It took us 3-4 years to outgrow that, and we were already larger than most companies ever will be.

Everything that uses NoSQL runs on some in-house solution, but it never implements the ORM or anything Django specific. It's very custom, and very compact.

For example, our Redis usage is all simple models that just provide an abstract interface in whatever they're implementing, almost always powered by something like Nydus (

We tend to store things like aggregate counters, denormalized views of data, and various frequently accessed data (as a cache).

See Questions On Quora

Posted on 27 August 2012

What kind of modifications did Pinterest make to Django?

We mostly use Django to handle some basic controlling, namely URLs getting routed to methods (views in Django parlance, we call them handlers).

We have only one DB table that uses the Django ORM, everything has been migrated to another tier that manages our data.  For that DB we actually use a custom DB router that pools mysql connections.  Nothing fancy, it's borrowed from SQL Alchemy.

We use Jinja2 templates which is (partially) bridged together using the Jingo library.

We bypass Django's testing framework entirely and have our own system that is better suited to unit-testing than integration testing.  It's driven by nose.

It's perhaps not accurate to say we've modified Django.  We install Django via pip and leave it alone, but Django is just python and we're doing (mostly) pythonic things to satisfy our requirements.

See Questions On Quora

Posted on 25 August 2012

How should we proceed for developing a website with the Python/Django framework?

Here you go:

  • Wireframe your project and then build from there.
  • Try to use PostgreSQL in production. Django is optimized for it. Many argue it handles relations better than MySQL. Providers like Heroku keep your system up to date.
  • Use Django 1.8 or higher for database migrations, django_extensions only for TimeStampedModels, django-debug-toolbar for debugging, django-floppyforms for better widget control, django-crispy-forms for easy form generation, django-storages-redux for delivery of static media.
  • Start with Heroku or another PaaS before standing up your own slices. If your site takes off and Heroku gets expensive, only then think about your own servers. If you do use Heroku, add these to your project: dj-database-url, django-heroku-memcachefy
  • Research additional apps to wire in via
  • Keep the logic out of your and urls file. If you are traversing the filesystem to find which apps you have and then using that to generate a INSTALLED_APPS tuple, you are doing it wrong. Write out every app as a string. Trust me on this one.
  • Never cut-and-paste Django/Python third-party apps into your project. Instead, use virtualenv and pip.
  • Keep any and all code out of your files.
  • Document what you need to get your project installed and running locally. Otherwise you'll forget it at the worst moment possible.
  • Build a basic prototype that works, then worry about pixel adjustments and/or all the nice JavaScript things you want to do.
  • Github all the way. As students I believe you get a discount.
  • Check out our book, Two Scoops of Django: Best Practices for Django 1.8.

See Questions On Quora

Posted on 8 August 2012

Is there anything Django can do that Flask can't with blueprints/extensions?

Having used both - Django for full-fledged sites, and Flask for API backends, Django's benefit is in its community, insanely good documentation, easy-to-extend middleware and context processors, and of course the built-in admin site.

Flask is capable, but I found myself mimicking a lot of the functionality in the fashion of Django while using it. SQLAlchemy is pretty cool but requires a MUCH larger learning curve. Testing is much more manual. Documentation is severely lacking compared to Django.

I don't really buy in to the separation-of-apps thing in Django. It works as psuedo-namespacing but i've rarely if ever seen apps be able to exist completely independently of each-other... so I won't tout that as a feature.

That said, if your site is significantly small... or as in my case, if you are building say, an API that only passes JSON back and forth, or may only have one or two pages to the entire site, Django can be an elephant gun for an ant. I used Flask, SQLAlchemy, and the "apy" Flask extension to build an API to backend a turn-by-turn iOS game. It scales just fine, and is less resource-heavy than Django.

Most importantly, though, is due to the maturity in Django, things like JohnnyCache exist and are amazing, stable, and scalable. SQLAlchemy has serious issues with putting objects in memcached, for instance, that you have to work around from scratch (and won't find out about until you think you're almost done.)

In either case, use Jinja2 - so much faster, more capable, and binary-cacheable. :)

That's a lot of words, I hope you find it helpful.

See Questions On Quora

Posted on 4 May 2012

What are some best practices for Django development?

Here are some things I have learned over the years that have helped me:

1. Try to setup your projects with the following directory structure


apps - contains subfolders with specific functionality (static, accounts, etc)

configs - stores all configuration related scripts (gunicorn, nginx, celery, mongdb, redis, etc). It's useful because you can use fabric (put command) to copy these over to the correct locations on a server

deploy - contains all deploy scripts, set up in similar manner to this project[1]

A lot of examples you see online put everything into a single, but that gets really messy as a project gets larger. Having a deploy folder that is organized like django-fabtastic allows you to cut-and-paste it over into other projects if you are using the same technologies

settings - a folder (not a file like that is setup based on this reference [2]

You could use, etc. but that yipit guys got it right and that is definitely the way to go

static - contains js, css, images, types/fonts

templates - all your html files

2. Use gunicorn[3] instead of apache. If for no other reason, a print statement in code wont crash the entire site. Gunicorn is less bloated and very easy to configure. And large sites like instagram are using it at web scale so dont let people tell you its not a good idea - it will make your job easier and you can leave the office and drink a lot more beer

3. Use celery for anything that can be made asynchronous (sending emails, uploading photos, etc). Dont make the user wait for the request to return, push it onto a queue and let celery do the work for you. Also, do not use rabbitmq as the celery backend, use redis. RabbitMQ is supposedly more stable and messages cant get lost, but it's also a pain to configure and 99% of people can afford to lose a message because a lost message really doesnt matter that much.

4. If you are going to use a SQL-based solution, then use South for migrations. I  have had a lot of success migrating away (completely) from Django's ORM[7] and sticking to PyMongo[5] + MongoEngine[5]. Development is way more fun if you're using MongoDB, if you do not believe me, try it out. Say goodbye to painful schema migrations. Ya, and I know, MongoDB doesn't scale, but guess what, it does.

5. If you need to make a REST API, then use Django-TastyPie[8]. Unfortunately, there is currently no good solution for constructing RESTful APIs if your backend is MongoDB. If I am wrong, provide a link please because no one on StackOverflow could[9]

6. Do not use for unit tests, put them in a directory called tests/ and import them in that file. Also, trying using
nose, it's really cool.[10]

7. Look and good open source project for reference. The most obviously is the Django project itself[11], but Newsblur[12] and Everyblock[13] are also great references:

That is it- that is 3 years worth of trail-and-error for free!


See Questions On Quora

Posted on 1 April 2012

Do Python programmers have a tendency to write their own software instead of contributing? Why?

I think you'll find that PROGRAMMERS have a tendency to develop their own thing rather than contributing to an existing project. It's even got its own TLA: NIH (Not Invented Here).

It's not always a bad thing. When Dave Winer expressed dismay at Douglas Crockford for inventing/discovering JSON when XML and XML-RPC already existed, Douglas responded:

"The good thing about reinventing the wheel is that you can get a round one."

See Questions On Quora

Posted on 22 January 2012

Is Django on its way out?

Django is not on its way out - It's the most popular python-based web framework. It is the "Ruby on Rails" of Python (except Python is a nicer language and Django does not have as much "monkey patching"), and large sites (Disqus, Instagram, Pinterest, Mozilla, etc) have proven it can scale. It has a large ecosystem and a lot of great third-party applications. Although ruby/rails is popular, Python will continue to be the language chosen for data-driven /mathematically intensive web applications, and because Django is the most popular python web framework, this will help it to continue to gain traction. (The development of PyPy will most likely convert Ruby engineers to Python engineers for performance reasons also). If you want comet functionality, be a man and combine Django & Tornado or take the easy way out and use django-socketio.

See Questions On Quora

Posted on 10 January 2012

What are the benefits of developing in Node.js versus Python?

Maybe there are none? I know that sounds like a troll, but you should consider it as a possibility. A lot is made of Node's asynchronous nature, but you can do event-driven apps in Python (and many other languages as well). It's not that hard, there is no magic.

Of course if you really love JavaScript programming then obviously Node has an advantage there. That's purely subjective though. Most programmers that I have worked with are pretty good at using different programming languages for different tasks.

Pragmatically there are some disadvantages as well. Being a younger language, you can expect more bugs, less documentation, and missing pieces. Of course all of these things are getting better all the time and there is an active community around Node. There's also a very active community around Python, Django, Twisted, etc. as well. In exchange for those bugs you get to use a technology that is considered very hip currently. You get "credibility" with some kinds of people. It's like Rails circa 2006-2007. If that kind of stuff matters to you, then that would be a huge advantage.

See Questions On Quora

Posted on 27 December 2011

I want to learn to code Python and Django (web framework). What's the best way to start for a programming newbie?

Although I think Python is a better overall language, if you just want to slap a utilitarian web interface on some backend code for internal use then PHP might be a better language to learn. It's easier to setup on the server, will run on virtually any host, and is a more out of the box solution.

As for Python/Django:

If you have never programmed before, it's definitely worth learning Python before you get to Django. Someone with experience could skip to a Django book/tutorial and pickup Python on the way - it's a simple language with very clear, easy to read and understand code.

How long it takes you to learn what you need to know is highly variable. If you are just trying to write some automation scripts to help cut down some manual labor, then you can probably go from zero to this point in a few weeks (maybe 20-30 hours). If you want to write production quality web apps using Python/Django, it's going to take longer.

Setup The Environment

First download Python if you don't have it. I prefer Linux, but your MacBook will be more than sufficient as a dev machine.

Python is in a state of limbo between the 2.7 release version and 3. While 3 is the future, it introduces some intrinsic changes which many of the popular libraries do not yet support, Django included. Your best bet is to start with 2.7 and switch to Python 3 later. Also, most of the learning material available is still written for Python 2.

You can write code in any text editor. My favorite, and an up-and-coming basic code editor is Sublime Text. It is simple, elegant, and very functional. It costs $59, but you can use it free for an unlimited amount of time (as of right now). Well worth buying though.

Many Mac developers love and swear by TextMate. It's more developed and further along than Sublime, I think. Costs $54, and has a 30-day trial.

If you get deeper into programming and want a full featured integrated development environment (IDE), then PyCharm is top notch. It costs $99 and has a yearly renewal fee for updates, but is worth it. Something like this has a much steeper learning curve than Sublime Text or TextMate, but they can save you time and keystrokes in the long run.

I'm going to assume you are familiar with working in the terminal, since you have IT experience. If not, this might be a good starting point:

Django apps can be run entirely on your own dev machine, but if you want to put it on the web to be accessed by others on your team, or from other machines you will need a host. There are some good questions on Quora about hosts, but ensure you choose one that allows Python and SSH access. I recommend finding a cheap Virtual Private Server (VPS), although this might be too steep a learning curve for someone without experience. (You say you've done a lot in the IT field, so some of this might be too basic for you, sorry).

I recommend learning and using Source Control. This helps manage your code revisions, and is particularly useful if you have more than one person working on it. I personally use Mercurial, but Git is more popular. is a good intro guide for Mercurial. looks to be good for Git, but I haven't worked through it yet.

In addition to using Source Control, you'll need a source code repository (you'll learn what this means in one of those tutorials. GitHub ( is the most popular, with BitBucket ( coming in second. You can use Git on either, but GitHub does not support Mercurial. Also, BB has better options for free accounts - unlimited free repos, whereas GitHub limits you.

You might feel overwhelmed trying to learn how to program Python, learning Django, and trying to figure out source control and a myriad of tools all at once. In my opinion it's best to get down a version control workflow early on, rather than putting it off. You'll develop good habits early on that will help you down the stretch.

Where to Learn
There are a ton of resources for learning Python, and quite a few for Django. Be sure that whatever you choose, you go with resources that consistently use either Python 2 or 3. Also, stay away from small tutorials and stick with complete references. Learning from piecemeal tutorials will leave you with fragmented knowledge, and they are usually lower quality.

Here is a list of references taken from another Quora question. The key to learning how to program, in my opinion, is to practice a lot. So do the exercises these books contain, and do more programming on your own.

Online Tutorials & Ebooks
All free

Recommended: (A higher level look at programming with Python as the tool; highly recommended if you want to be a good programmer)

Recommended: (A higher level look at programming with Python as the tool; highly recommended if you want to be a good programmer)

Sometimes having a physical book makes it easier for some people to learn. Many of the above ebooks are available in hard copy.

Dive Into Python
Think Python
Learn Python the Hard Way
A Byte of Python

How do I learn Python?

All of those are Python references. The online material available for Django is more sparse, but there are some good resources.

The Django Book is the starting point for most people:

There is, of course, the official tutorial: I found Django Book more useful. However, get very familiar with the Django docs. They are very good, and you will be spending a lot of time digging into them.

This is a highly recommended hardcopy book for learning, but I've not used it:

Prefer video? This series ought to be very good: I have not tried it yet either. There is a $25/mo fee for their service

Getting Assistance
Inevitably, when you are learning or attempting to build something, you're going to run into a brick wall at some point.

This is my workflow if I get stuck on a concept, or while programming:
Check the Documentation -> Check the Source Code -> Search Google -> Ask on StackOverflow

Asking is always a last resort, quite simply because figuring it out on my own gives more of a sense of pride and accomplishment, and I'm more likely to remember the solution.

Python Docs:
Django Docs:

See Questions On Quora

Posted on 15 December 2011

Why is Ruby/Rails or Python/Django better than PHP?

Like Gidi Meir Morris says, comparing PHP to a framework is a bit problematic. A more accurate comparison would be to compare PHP to Python or Ruby, and to compare a framework like CakePHP to Rails or Django.

PHP, as a language, has a bad reputation for three main reasons:
  1. PHP is INCREDIBLY easy to pick up. In part because the language is designed that way, but also because there is a lot of documentation for PHP targeting people that doesn't know anything about programming and should not ever be taught anything about programming. :)   This is my favourite example:  WPDesigners guide "So you want to create Wordpress themes, huh?"   It is brilliant in the sense that it assumes absolutely NO knowledge about what the hell you are doing, and teaches PHP without the need for any prior knowledge whatsover. Which is great, but the problem is that these people then think that they can actually program, and then then proceeds to release a scourge of untested, bug-filled, unreadable, horrible pieces of code on the world, which has given PHP a bad rap. Drupal (and the insane amount of piece-of-shit plugins that is available for it) is a fine example of this.
  2. It's disgusting to a compsci-person. The language, while absolutely capable, is like a Leatherman duct taped together with a chainsaw, a hammer and a chicken. It's not cleanly designed from the bottom up by a computer scientist, like most other languages, resulting in what is elaborately described in the answers to What are the horrors of PHP?
  3. PHP is no longer cool. Around 2004 when Facebook launched, PHP was the shit. Since then, development of it has stagnated and the throne as the cool new development thingamabob has been overtaken by Ruby on Rails.   If you doubt the stagnation of PHP, read this and compare the TIOBE index if PHP in 2005 with that of now:

Follow me if you're interested in this kind of stuff!

More reading:

See Questions On Quora

Posted on 25 May 2011

Why is Ruby/Rails or Python/Django better than PHP?

Your question is flawed, as it compares two different things.
PHP is a language while Rails & Django are frameworks.
You are comparing apple and oranges.

I'll explain why people usually react the way you describe, though:
  1. What experienced developer hate most is rewriting what has already been written and fighting their code base to make it do what they want. This is where frameworks come in. A framework gives you a ready made code base which has been designed and tested by many developers who came before you and give you a well thought out solution for common problems. This saves you time and headaches. Rails & Django are two good examples of frameworks which solves specific problem (specifically those surrounding the repetitive work which goes into Web Application development).
  2. PHP is a language, just like Ruby & Python. All three are good languages, with specific weaknesses & strengths. PHP specifically, especially amongst less experienced developers, has a tendency to become spaghetti code... which is why many hate it. I have worked with PHP for years and find it annoying in the wrong hands, but if your developers are good PHP is a fine language to use.

See Questions On Quora

Posted on 25 May 2011

How does Backbone.js interact with Django?

Django and Backbone.js are separate projects, and there is no direct interaction between the two frameworks. I.e., they aren't tightly coupled. You can "connect" a backbone.js file to a Django project via Ajax.

In my opinion, the easiest way to do this is to use Tastypie: Tastypie makes it easy to create REST-based interfaces in Django.

There is an example project in Github that demos how to connect Django to Backbone.js via the Tastypie Django app. You can find it at:

You can find Tastypie at:

See Questions On Quora

Posted on 30 April 2011

How do you query with a condition on a ManyToMany model in Django?

Without your specific model definitions I'm not entirely sure what you're doing wrong since this feature works for me just fine (and I use it all the time). I think perhaps you might be missing the "through" option on many-to-many fields (see it lets you easily define these sort of "augmented" relationships.

Here's how *I* made this work; perhaps it'll help you figure out what's going on in your specific case. My models look like:

from django.db import models

class Person(models.Model):
    name = models.CharField(max_length=200)
    groups = models.ManyToManyField('Group', through='GroupMember', related_name='people')
class Group(models.Model):
    name = models.CharField(max_length=200)
class GroupMember(models.Model):
    person = models.ForeignKey(Person, related_name='membership')
    group = models.ForeignKey(Group, related_name='membership')
    type = models.CharField(max_length=100)

And given that definition, queries like the following work just fine:

# Which groups is Jim in?

# But which groups does Jim admin?
Group.objects.filter(people=jim, membership__type='admin')

# And which groups is Jim just a member of?
Group.objects.filter(people=jim, membership__type='member')

I've put the full code I used to check that this works at; hope it helps!

See Questions On Quora

Posted on 15 February 2011

What web server suits Django best?

I'm still a big fan of a stripped down Apache+mod_wsgi running behind nginx.

Nginx handles static files, gzip, trickling to slow clients, load balancing and having a configuration language that's actually pleasant to work with.

Apache just sits there serving up dynamic Python pages via mod_wsgi, using the shortest possible config.

The reason I like Apache for this is I don't need to babysit the process at all, unlike if I was using FastCGI or running a separate Python app server.

See Questions On Quora

Posted on 25 January 2011

What are the best ways to improve Django performance?

I'd like to follow up on what Alexander said.

1. Indexes are going to get you database performance, but are a necessity. it's also important to look at your query and join patterns.

2. Generic relations are fine. They are not slow, just more difficult to manage in your code base.

3. Dont ever use select_related without arguments.

4. Dont execute any queries in your template. IMHO if you're caching template fragments you're doing something wrong.

See Questions On Quora

Posted on 17 January 2011

What is the best Python web app framework? And why?

simplest != best.

Some serious ones:

There are many more, read this:

For the simplest one, I'd go with plain WSGI, otherwise digging with Django or Flask.

See Questions On Quora

Posted on 7 January 2011

What are the benefits of developing in Node.js versus Python?

  • You can use the same language for both client and server development.
  • The Chrome V8 engine: this is the single biggest selling point . There are many optimizations in the V8 engine ( most notably hidden classes and inline caching) that put it head and shoulders above any other dynamic language implementation [1].
  • Javascript as a language with closures is well suited for callback centric asynchronous programming.

[1] http://shootout.alioth.debian.or...

See Questions On Quora

Posted on 6 January 2011

What are the benefits of developing in Node.js versus Python?

I see three major "wins" that Node.js has over most other development environments (including Python):

  1. It's built to handle asynchronous I/O from the ground up. Other environments have async. I/O features, but Node's the first environment where it's really pervasive. In most environments you'll find only limited pieces available in async. flavors, but in Node everything (or nearly everything) is async.-only. It's actually hard to write non-async. code in Node!

    Now, there's some debate over whether async. programming is really the silver bullet some claim it is, but in my mind there's little doubt that it's a really good match to a lot of common web- and network-development problems.
  2. It's "just JavaScript." Every time I  context switch between Python on the backend and JavaScript on the frontend I waste stupid amounts of time making silly syntax errors — semicolons in my Python, missing braces in my JavaScript, etc. Some days I might switch a dozen or more times, and it really feels like I'm wasting brain cycles swapping in and out my language knowledge. Staying in a single language feels faster.
  3. It's new, so it has the benefit of being able to learn from previous languages' and environments' mistakes. Better, Node can correct those mistakes without the backwards-compatibility concerns. For example, the Node package installer, npm, is already quite a bit better than many of its equivalents. All in all, Node feels very polished and modern; it hasn't had time to accumulate the cruft other languages/environments have.

    (Sadly, I'm all too sure it will accumulate this cruft eventually. Everything new feels old eventually.)

I highly recommend that you take the time to learn Node — it'll make you a better developer, whatever you end up using. I learned Node last year, and I'm very happy I did. It's a cool piece of software, and it's a great tool to have in your toolbox.

See Questions On Quora

Posted on 6 January 2011

As someone learning Python/Django, should I set up a local server on my Mac or should I just use Google App Engine?

Absolutely yes you should setup a local server. And by that, I mean simply run this command inside your project: ./ runserver (I can't tell you how many times I type that every day...) then point your browser at http://localhost:8000/ and you should see the blank django page.

Follow the tutorial on -- it's a very easy step by step way of getting started with Django.

And remember that Django is not Python and is certainly not App Engine. If you're just learning, there's no reason to put your stuff on a server -- just run it locally and learn that way. When you get to the point of wanting to post your project publicly, there are oodles of tutorials out there on how to do it.

In summary: stay away from GAE for now, run the local server, use sqllite for your database -- don't mess with setting up mysql, and don't forget that learning some good ol' fashioned python will be helpful along the way.

See Questions On Quora

Posted on 5 January 2011

What is the Heroku equivalent for Django applications?

Right this moment there's nothing for Django that's as easy as Heroku, so if you need something right now your choices are quite limited. There are, however, quite a few solutions being worked on, some of which offer private alpha/beta accounts. There are also a few DIY solutions worth looking at.

I'll go into more detail below:

If you need to deploy an app right this minute without much fuss I'd suggest WebFaction ( They're the best option for cheap and easy Python deployment right now as they understand the problem space very well and offer excellent support. You also could consider Google's App Engine (, but note that you'll be quite limited in the parts of Django that'll run on App Engine.

If you're willing to wait a bit, I know of at least four Heroku-inspired Python/Django hosting solutions in the pipeline:

None of these services are fully available yet, so I can't really speak to their quality. However, most of them have pretty smart people behind them, so I fully expect they'll be pretty nice. It'll be a nice horse race on availability, features, and pricing -- good for users!

Finally, one DIY solution you might want to check out is Silver Lining ( It's basically a DIY version of what the above services are trying to build -- you'll do a lot more yourself, probably, but not nearly as much as if you needed to build a server from scratch.

Good luck!

See Questions On Quora

Posted on 4 January 2011

How does Flask compare with Django?

Flask is simpler than Django much like Sinatra is simpler than Rails. It's generally one file, not counting templates and static files, and relies on your bringing in your own ORM and other pieces.

Django is more cumbersome, simply by having more files and moving parts, but is a bit more of a one-stop-shop solution for building web apps.

See Questions On Quora

Posted on 25 October 2010

What is the best Python web app framework? And why?

The two that stand out to me are Django and Pylons.

Pylons makes more sense if you want to invest a lot in doing custom work on your framework; Django might be a better choice if you want to make a site like a newspaper (or other traditional CMS product.)

cherrypy can be a good choice for very small projects.

They both have lots of documentation and lots of users and are easy to setup.

I put some time into researching this in the spring of 2009.  We chose Pylons because the different parts are easy to swap out.  For example, we didn't want to use a templating system, and it was easy to choose any templating system or just not use one with Pylons.  My impression was that it was slightly harder to do this in Django which has a tighter full stack integration.

If you want to use your web app framework as a CMS, Django is probably a better choice.  There are lots of convenient plug-ins and all the different pieces are setup to work up with each other so it's easy to build things that are similar to a newspaper really quickly with it, and it has lots of administration and account things built-in in a way that Pylons doesn't.

Ben Bangert, the creator of Pylons, has a somewhat informative discussion of Django vs. Pylons here.

For small projects, I've used cherrypy sometimes, which isn't perfect but runs as a standalone webserver and requires very little boilerplate to setup.  Flask is a new framework that is gaining popularity and seems to fill the same niche but be a little bit more refined than cherrypy. ( )

See Questions On Quora

Posted on 14 December 2009 search results

Things you love and hate about using Celery with Django.

I am the author of django-q , a task queue and scheduler application for Django. Even though I never wrote it as a Celery competitor, I keep getting questions like 'Why should I use this and not Celery?'.

This project is only a few months old and I wrote it specifically to make scheduling and asynchronous tasks easier to use in Django projects. So I am asking you, Djangonians with a taste for tangy vegetables, what do you love and hate about using Celery with Django?

I'll try to make a comparison based on your input, which hopefully will help future developers make an informed decision.

submitted by koed00 to django
[link] [71 comments]

Posted on 28 August 2015

Why Django over PHP xor Ruby?

I plan to learn at least PHP and Django but I'm curious why there's a preference. I asked the same question over on /r/PHP and while they gave good reasons for using PHP they didn't have a clear idea of why someone would use Django or Ruby.

This tells me they likely just don't know.

From what I read online, Django and Ruby are way more popular among startups and 1 product shops, does anyone have a good intuition as to why? Is it purely a matter of more concise and legible code?

Thanks for any insight :)

submitted by charlesbukowksi to django
[link] [51 comments]

Posted on 18 July 2015

Anyone here using Python 3 with Django?

I am searching online for a host/cloud provider that has easy-install django setup, but it seems everyone uses Python 2.7.x. I understand a lot of existing stuff relies on Python 2.7.x, but it seems people don't want to move to 3.x and so there is very little information about it online.

Is anyone here using Python 3.x with Django?

Who is your host and what is your experience?

Is it inadvisable to jump to Python 3.x at this point?

submitted by YouAreSalty to django
[link] [54 comments]

Posted on 8 June 2015

what does django offer that rails doesnt?

hi all, i've asked the opposite question on the rails subreddit too, and i've so far got comfy with django, and now that i'm at a certain point of django, what is it about django that wouldy throw me off onto rails because it may be nicer to do on rails?

i like dango because its probably as popular, the docs are better i think, and of course python is used more than ruby (i think).

so make me stay on django!

submitted by a5myth to django
[link] [40 comments]

Posted on 23 February 2015

What is Django not good for?

Hi, I'm a couple months into Django and it is my first step into web development, and I was wondering what (kinds of websites?) is Django not so good for? If you could briefly explain why, and also what an alternative to Django might be in that instance that would be great. Thanks!

submitted by Caught_Up to django
[link] [47 comments]

Posted on 3 December 2014

The Django Tutorial: Dated and Confusing?

Hello Django Community! I'm curious to hear from Django users (experienced and new) in regards to your experience working through the tutorial, and then moving on to building your own project.

I've heard some people claim that the tutorial is "simple, straightforward, and all you need" to get running with Django. I've heard other say they were just as confused (or more so) after doing the tutorial as they were before doing it.

For me, I didn't fully understand Django until I learned Flask. Flask started at ground zero: a hello-world application. In 7 lines of code and two terminal commands a new user can have an application up and running. There's no discussion of ports, databases, or assumption that Flask is installed already. It takes a total noob, gets them up and running, and then starts things off in an easy-to-read format. There's even a separate forward for experienced programmers.

Once I had deployed a Flask project and tried Django again, I finally understood what was actually going on in Django (and its strong points). Now, after using both for many projects (both large and small), I thought I'd ask: Do you think the Django tutorial needs a rewrite? If so, what would you do to change it? I'm also curious to know what your experience with web development, python development, and MVC was before you started learning Django.

My opinion: The Django Documentation direly needs an overhaul to appeal to the MVC/MTV/Python framework noob. It simply introduces too much, too fast. Sure, the Admin is cool...but does it belong in the tutorial? Sure, a HUGE part of Django is the ORM/models...but do we really need to start talking about databases before introducing other parts of the framework?

On page one of the tutorial, the new user is instantly hit with Database setup, creating models, migrations, and the python shell. On page two, we completely switch gears and play with the admin. Finally, on page 3, we talk about views and actually displaying our own content on the front-end. It's true, Django is a HUGE framework when compared to Flask. But is it really appropriate to drown the new user in so much, so quickly?

submitted by rnevius to django
[link] [31 comments]

Posted on 27 October 2014

We are the authors of High Performance Django. Ask Us Anything!

Hi r/django! We recently published High Performance Django and are having a live Q&A session this Thursday, October 16th at 19:30 UTC. We'll be taking questions from IRC (#lincolnloop on Freenode), Twitter (use #hpdjango) or here and answering them on a live Google Hangout. Fire away with any questions you have about Django, deployment, scaling, etc. and we'll do our best to answer them!

You can tune in at

submitted by ipmb00 to django
[link] [48 comments]

Posted on 14 October 2014

Lets just dream Django 2.0

This post is more for a little fun than anything else. The idea behind it is you create your wish list of features for Django 2.0 it can be as sensible or far out as you like.

Personally I would love to see complete support for nosql (kind of speaks for it self) I would also love to see a full wsgi server built into django something like gunicorn by default so deployment becomes a breeze (not that its really hard at the moment).

submitted by mattwritescode to django
[link] [60 comments]

Posted on 7 August 2014

You have all been a huge help to me in my Django journey, so I thought I'd share what you helped build

Around 13 months ago, I decide to learn Python and Django so I could start building some website ideas I had. Previously, I just knew HTML and CSS and was using the ExpressionEngine CMS to build sites. It served the purpose and was good enough I guess, but I couldn't customize anything as I didn't know PHP. I wanted to be able to make changes to the way the site worked so it would do what i wanted and not have to bend around what the CMS could do. So... after 13 months of work learning Python and Django well enough to feel like I could start on this site, I dove in and with a lot of help from you folks here, I've launched:

It's a site where golf addicts like myself can signup, share, discover and discuss all things golf. Aside from being able to post links (the site uses beautifulsoup to scrape the url and return data), members can follow each other, favorite links, like links, report links, comment, and like comments. I built a basic reputation system into it that keeps track of points when each users does something on the site, i.e., submits a link or comments.

Some apps I used:

Thanks for looking!

submitted by dsizemore to django
[link] [25 comments]

Posted on 25 June 2014

Django VS. .NET

Hi, my client is asking me why we chose Django for his project and why it was a better choice against .NET I don't know .NET, can you help me explain why (and if) Django was actually a better choice than .NET for their website? Can you post some "literature" about the argument? To better understand the project, consider it is a custom CMS, totally built on AJAX requests.

submitted by carusog to django
[link] [52 comments]

Posted on 17 March 2014

Django Unchained. Dr. King Schultz being a Dentist explained.

In Django, one of our heros Christopher Walt'z' Dr. King Schultz at one point was a Dentist-which seems like a strange offbeat choice to have a character have that as an occupation at first. Dig a little deeper and start looking at the naming conventions of the film.

You have Dr. King Schultz, a third party outsider who's current job is to thwart the evils at hand and the spreading issue of racism and slavery running rampant throughout the south.

Fine- he used to be a Dentist- whatever- this is Tarantino right? He's wrought with quirky decision making.

But then take a look at who he's first hunting; The Brittle Brothers. Aside from a few things, the only thing that comes to mind when I hear the word Brittle is sweet sugary Brittle Candy- as in Peanut Brittle and Caramel brittle, all syrup cooked to sweet perfection. He finds and eradicates them with the help of freed slave Django, only to name his next target; Calvin Candie- owner of "Candie Land" In short- the south is an invented cavity laden cesspool. The infection of slavery is growing and Dr. King Schultz is the living remedy.

Not to mention to one look at Calvin Candie and you see-maybe more than anyone-is in need of a Dentist. He sucks down Coconut juice- pure, cavities causing straight cane sugar. So in context you see, He IS the cavity and Dr. Schultz is there to to eradicate him.

Tarantino uses the so-good but-so-bad for you analogy of candy as the infected spreading epidemic of slavery and racism in the south to highlight it's need to be stopped.

submitted by pgibso to FanTheories
[link] [59 comments]

Posted on 15 March 2013

What are your favorite django apps ?

I'll start with my own list:

I will add more later with links to projects repos (I'm on mobile right now)


Some have been quicker than me, but I'll list them anyway:

Those are some I developed and use frequently:

submitted by hhh333 to django
[link] [21 comments]

Posted on 23 June 2012

The Onion Uses Django, And Why It Matters To Us

We wanted to post earlier why we like/use Django, but, we get pretty busy around here, so a bit late. Sorry if this is duping any existing threads.


This is not a Drupal vs Django fight, we're not here to slag Drupal, Drupal has been important to The Onion, but The Onion decided to stop using Drupal a long time ago. The Onion deployed a Drupal site back in 2005, at the time it was the right decision given the resources, yet even then we were interested in using Python whenever possible. We feel it is a vastly better designed language than PHP and of course any framework you're using is only as good as the language. We started rolling out other projects, like The A.V. Club, in Django. Just this past weekend we switched over The Onion proper, and we're seeing immediate gains in speed, maintainability, and stability. As a team we have a pretty broad base of experience and I know we're all in agreement that what we've got now is better, enormously better. We're not just using Django, we have some other pieces that made our lives easier: git, PostgreSQL, VPS's. So this isn't just about The Onion using Django (and recommending it), but generally that you can make things better by investing time and energy into new technology.


It took us about 3 months to convert our old Onion site to Django while we also maintained and built on our other sites. We already had some components written for A.V. Club, including a strong article and image model, so we felt we could concentrate on coming up with good models that covered the necessary editorial cases. The hard part was more how to fit pieces of content from ten years ago consistently and cleanly than it was writing the code to make use of the final model. We broke out templates into nicely reusable components and made use of the Django template hierarchy. Multi-db made the conversion of data from a MySQL db to the PostgreSQL db fairly easy, so we could rerun importing old data into the new system and fix and tweak. There is an enormous advantage using Django, sorl and PIL for creating image crops based on templatetags which gives the editorial and design folk flexibility they need (no more css cropping odd-sized images into place). Again, lots of work went into actually cleaning a site that goes back to 1996, Django allowing for a relatively minimal amount of coding -- particularly when it comes to the admin side for content entry, Django trunk we found almost ready to go as-is (something we did not find with previous Django). That we could use the Django admin rather than create custom entry forms I think saved us 2 months work.


Cleaner. Much cleaner. Proper unit testing. Real reusable components across applications. An ORM rather than a just a series of functional query helpers. Tighter conventions (q: how often do people using Python argue about bracing styles? a: they don't). We can update then test a Django core change without worrying about having to take apart our applications, and if we do need to make a change, it's easy to do because there's less, much more readable code. Every member of the tech team can meaningfully contribute because there are fewer specialized or hacked together pieces. We can move more quickly on large changes because of all these reasons. And we're more stable because of all the previously expressed points.

-- The Onion Tech Team

submitted by westononion to django
[link] [115 comments]

Posted on 24 March 2010