Learning Django

For the past few weeks I’ve been learning the Django Web Framework. This isn’t my first time using Django—I first had a go at this a couple of years ago and really did not like it. At the time I felt like it was big and bloated and overly-complex for my liking, so I went off looking for alternatives and discovered Flask.

I built several small webapps with Flask and loved it, but as soon as I wanted to do something a bit more advanced like including user registrations (and all the security requirements that comes with this), I found it difficult to stick with Flask. This is because Flask is a micro-framework so it only includes the fundamentals required to create a web application and it leaves additional functionality to third-parties to fill the gaps.

This is mostly a good approach and having an extendable platform is a key feature for any web framework. But what I found was that the key extensions required to enable basic security features were often out of date and it was unclear who was maintaining them, or they overlapped with other similar extensions. Flask-Security was an example of this which led to another developer needing to fork the extension to be able to fix bugs.

It was at this point that I started to have doubts about Flask and since I wasn’t willing to take the risk with security I started to look elsewhere again.

This is where Django comes back into the picture. As a “batteries-included” framework, it contains everything you need to build a web application with a rock-solid and secure authentication and authorisation model built into the core. So I decided to work my way through the Django Docs tutorial and started reading blogs and seeking out other tutorials online.

I realised that my previous poor experience with Django was due to my own inexperience with Python at the time, and no fault of Django. To get the most out of Django, you really need to have a reasonable understanding of Python classes, inheritance, and be comfortable importing code between files and modules.

So here I am, back in the Django world and loving it. With a couple years of Python experience under my belt, and the knowledge I learned with Flask, I’ve been able get up to speed pretty quickly and am now finding Django a pleasure to work with. This is not to say that Django is better than Flask, they are both great products but both serve different markets.

What I’ve really enjoyed about Django is the wealth of knowledge available online. The Django Docs themselves are thorough and extensive, though far from perfect. In my next blog post, I’ll list some of the key resources I’ve been relying on so far.

Stay tuned…

Leave a Reply

Your email address will not be published.