howchoo was originally built in PHP and Codeigniter, then we switched completely to Django in February of 2015. I recently responded to a question on Reddit about this exact situation: "My app is built in PHP/Codeigniter, should I rebuild in Python/Django?". I gave a brief answer, but I decided to explain in a little bit more detail why howchoo uses Django. Or more specifically, our favorite parts of Django.
The answer to 'how' we are using Django is closely related to 'why' we are using Django. Put simply, we're using Django because of familiarity and all of the features it provides. Of course I will go into more detail about those features shortly.
When choosing a web framework and language there are a few considerations - performance, scalability, maturity, community, but I would say familiarity is of utmost importance. You will, of course, become intimate with whatever framework you choose, but it's important to start building with something you are already familiar with. This is especially true if you're starting your project with a couple of guys doing way too many things. There's a cost to using a totally new framework and language. With that said, sometimes the framework is so good it's worth paying the extra cost. In our case, we were familiar with Django and also believe that Django is most properly suited for our mission.
To provide context for the topics below, you should understand what is important to howchoo. If you're building an app with completely different priorities, this guide may not be as beneficial.
Blazing fast page loads
We're never satisfied with our page load times. They will always be too slow, and we will always be looking for ways to improve. We are delivering a lot of content to a lot of users and it needs to happen quickly.
As a publishing platform we hope to one day reach 100 million users per month. That's a lot. And that's a lot of pageviews. And since we're starting off with three engineers, it also has to be something that can start simple. We can't build for 100M users off the bat or we'll never reach 100k.
Code cleanliness is next to Godliness
So maybe that isn't true, but we still think it's valuable to write clean and organized code. This is also related to scalability in that we will be able to scale our dev team more easily if new engineers can quickly dive in. The web framework docs should be sufficient documentation for the majority of our app.
Now for the meat.
Here are a few of our favorite things about Django.
Models and Databases
To start, Django uses your Model definitions to build your database. I love this. You can look at your Django model to see which fields are in your table, and you never have to interract directly with the database. And in later version of Django (we're using 1.7 right now), to update the schema you simply modify your model, make migrations, and run migrations.
[add fields to model] ./manage.py makemigrations ./manage.py migrate
And if you're worried about what this will actually do you can run this after makemigrations to simply print out the SQL that will be run (not run it).
Also, Django makes querying the database very simple.
user = User.objects.get(id=1)
And updating is fun as well.
user.first_name = "Tyler" user.save()
Of course, most web frameworks come with at least a functional database abstraction layer (I repeat most). And Django provides the means to make some pretty complex queries - more complex than what is generally necessary.
Overall, dealing with database stuff shouldn't be a big concern when you're building a web app. Recent versions of Django make it very painless to manage your database.
To be completely fair, I didn't always love the way Django handles templates. Their approach is that it's acceptable to have some logic in the templates (or a lot of logic in the templates). At first, I was a little hurt by this. This is the kind of thing that you WILL use if it's available even if you shouldn't. Needless to say, I've made use of logic in the templates, and now starting to think it's ok. And over time, I've found Django's templating system to be more than sufficient for howchoo's needs.
Django's URL routing is a great combination of powerful and simple. Most importantly, I like how Django's urlpatterns are constructed. The urls files are easy to read and understand quickly what is going on. This is a huge advantage for such an integral part of an application. I've seen some frameworks where the routes are hidden and kind of cryptic. That is no good.
As you read before: howchoo was originally built in PHP/Codeigniter. And yes, Codeigniter provides built-in page caching, but this was ultimately the reason I started the rebuild in Django. I knew that page caching would be a HUGE part of our strategy for decreasing page load time, and I wanted something powerful. With Django you can cache portions of a template or the entire view with very little setup. It's quite magical.
Forms and ModelForms
Django's Form and ModelForm classes aren't beautiful, but they just work. In the most basic case, if you're using a ModelForm, you can have a functioning form in just a few (less than 10) lines of code. That includes constructing the form HTML, validating, and saving. Of course, most forms aren't this basic, but the form classes are highly customizable. Our guide tool pushes the form classes to the max, and it works beautifully.