With my new job I have been using Django for about two months. Most people say it is a ‘batteries-included’ framework, and indeed, it is. Here I want to give my first impressions about Django, to talk about what are the included ‘batteries’ and what I like and dislike about using it so far.
What Are Included?
Based on my experience with Django so far, useful included batteries are:
- A user authentication system so that you do not need to implement your own
- Form and field validation is part of the middleware, you only need know how to customize certain parts in the validation chain, and it is not hard; The official documentation is a must-read
- Messaging framework to display one-time notification message to the user after processing a form or some other types of user input. In my usecase, it was handy for displaying form validation error message to the user.
- Available view decorators to simplify your view handlers
- Django Signals to implement ‘Observer Pattern’. This is useful to make the components in a web system decoupled from each other and more event-driven.
What I Like About Django
A good piece of software requires good documentation. Django documentation is huge and comprehensive! According to my experience with Django so far, I could already find most answers and learn important concepts about Django directly in the online documentation directly. Django documentation is really one of its strong points.
Another advantage of Django is it is one of the most popular (and also most mature?!) web frameworks, therefore it is easy to find solutions (including countless plugins and third-party Django apps) and examples to more difficult problems from the opensource community. That means most of the time you do not need to build from scratch. For example, Huey and django-background-tasks are task queue solutions I researched about which have Django integration support (the solution includes an Django app).
What I Dislike About Django
I do not have strong opinions about Django as I haven’t had extensive experience with it yet, however, based on my limited experience so far, I found the template system in Django is inconvenient, because a python function cannot be called from within a template directly, and yet Django let you create a custom template tag or filter to achieve the same thing (then why bother?).
Another thing I found a bit inconvenient is Django’s ORM layer. It seems not flexible and cannot be ‘turned off’.
Some more insights about Django from other people can be found in this blog post.
My experience with Django is still not enough to judge that much; but once I gain more insights I will update this post to share more.