DEV Community

Cover image for Reasons why Django is the best web framework
Nishant Mittal
Nishant Mittal

Posted on • Originally published at nishantwrp.com

Reasons why Django is the best web framework

Choosing a web framework is hard especially now when there are a lot of frameworks on the market, each designed to address different project needs. Here is why I think that Django is the best choice in most cases.

What is Django?

Django - The web framework for perfectionists with deadlines.

Django is an open source and powerful web framework written in Python that encourages rapid development and clean, pragmatic design. It takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel.

It is being used by a lot of companies including Instagram, Pinterest, Spotify, Disqus, Dropbox, Mozilla, Reddit which makes it obvious that the applications built with this framework are exceedingly scalable.

What can you do with Django?

If you are a beginner, you'll love the approach the platform takes for making web development easier. If you want to make robust web apps with a minimal amount of coding, you will appreciate what Django framework has to offer.

You can do anything web-based using Django. From building e-commerce systems, CRM Systems, Email Systems to developing a REST/GraphQL based API server for your frontend application there's nothing that you can't do using Django.

The most awesome thing about Django that I'll talk about later too in this article is it's large community. Most of the times the features you need are already present in Django. However, if there not there's a very high probability that you'll find a Django plugin or package developed by the community that does that task for you.

Features

There are a lot of things about Django that I like. I won't be able to write about all of them, So, here are some of the most awesome features among them.

Batteries Included

You don’t need to code basic stuff, it comes pre-packaged. These packages were developed by professional developers, so you won’t need to spend time making sure they work correctly. Some of the features included in this framework are as follows.

  • It has a very powerful ORM. Once you’ve created your data models, Django automatically gives you a database-abstraction API that lets you create, retrieve, update and delete objects.
  • It makes handling the database migrations easy.
  • It has in-built Session handling.
  • It also handles URL Routing for you along with dynamic URLs.

Admin panel

Django has an customizable admin interface, so you can manage data using basic CRUD operations. It’s a very useful feature so you can start your project right away, without having to code this functionality. The admin panel can also be configured to have customized filters, or the data can be grouped using a particular field.

Template System

Django has it's own in-built templating system also known as Django template language (DTL). However, if you want you can also use any other template engine like Jinja2. Moreover, you also have an option to write your own custom template system. How cool is that?

Your template can be divided into further re-useable components, which also alignes with one of Django’s core template design principles and it’s a design pattern that stands for Don’t-Repeat-Yourself (DRY). It’s exactly what it sounds like, it means that you shouldn’t, at least in most cases, by copying and pasting the code. Your template, can be divided into reusable components such as the side navigation bar, the main navigation bar, the header of the page, the footer of the page and so on. This minimizes repetition and makes for writing efficient and cleaner code.

Super Customizable

You can tackle just about any web app development project, whether it is a basic website or a high-end web app. It is also compatible with all major databases and even works with multiple database management systems at the same time like PostgreSQL, SQLite, Oracle, etc. It’s fully loaded with extras and scalable, so you can make applications that handle heavy traffic and large volumes of information.

Django offers a large amount of custom web development options. Since Django is built around Python, the design rules of the coding language dictate that web development time needs to be optimized. You can get your custom apps developed in a much smaller time frame than any other framework would allow you to.

Security

Django takes security seriously and helps developers avoid many common security mistakes. You do not have to implement security features manually to keep web development going. he framework has protection against XSS and CSRF attacks, SQL injections, clickjacking, etc. A Django web application is fully secured with industry-standard user authentication systems.

Scalable and Reliable

As said above, some of the largest web applications like Instagram, Reddit, Spotify use Django as a backend framework, we can agree that it's both scalable and reliable. If you’re just starting, Django provides the functionality that enables you to create a small project and scale it as needed. You can handle more user requests and greater volumes of data if your web app goes through a growth spurt.

Community

Django has been around for a while now, and its large community makes the platform even better. As it's an open source project, Django is supported by active volunteers who constantly work on stabilizing and improving the framework. It has about 58k Github stars.

Apart from the developers that directly contribute to Django, there are people in the community who develop great plugins to make app development easier for budding developers.

Documentation

As a result of super huge community, Django has a suberb documentation. It has detailed quick-start guides, detailed release notes, backward-compatible changes. There are dedicated websites for the platform where you can find help for any issues that you may run into. If you need help with your projects, the community support can always be banked on.


That's it for this article. I would love to know what do you think about Django and this article. Please feel free to comment below or reach out. Thanks for reading!

Top comments (12)

Collapse
 
ericlecodeur profile image
Eric Le Codeur

I use both Django and Laravel. I love Django because it's easy to get going and use Python. But framework vs framework Laravel is superior is every way. For example, to bring a Django web app to production you will have to write a lot of boiler plate/config code. In Laravel your app is production ready day 1. Laravel package are develop and adapt to fit perfectly with Laravel. In Django many times you have to use a python package and make it fit to Django (with almost no documentation and you have to write boiler plate/config code).

Collapse
 
jhelberg profile image
Joost Helberg

I left django after a while as it is doing too much, some of it in the wrong way. The ORM will generatie terrible queries, so you end up writing all of them yourself, also database models never fit use-cases, so ORM's are almost always another level of no-abstraction. Role-management goes on top of the RDBMS roles, which is doing things twice and probably less well than your RDBMS. Forms and templates are OK though, but not worth the effort of going through python-pain. The best feature is that it will adapt to an existing database, greenfields are an exception and django is good in adapting to existing stuff. The migration features are useful only if django is the only way to access data. It never is, so migration normally is addressed at the database level with backwards compatibility.

Collapse
 
skorrborg profile image
steve-orr

Yes Joost, you're absolutely right. I found myself having to work-around the opinionated-batteries-included framework several times because it either didn't do what I needed or did it in a clumsy time consuming way to implement. I was fundamentally appalled at the crazy queries it generates.

Collapse
 
martinhaeusler profile image
Martin Häusler

The features of the frameworks don't matter when the language itself isn't strongly typed and compile-time checked... There are some ongoing efforts in that direction in Python, but I'm afraid it's too little, too late. For me, that disqualifies Python for any serious project.

Collapse
 
kateryna_pakhomova profile image
Kateryna Pakhomova

Django is one of those software development technologies that have the greatest potential in the industry.

We are very much into researching this topic, and want to present to you an overview of this framework, its benefits, and potential implementations.

Make sure to check it out:
softformance.com/blog/why-django-f....

We’re sure that it will provide you and your readers with tons of practical information and examples of successful Django implementation.

Don’t hesitate to use our link for a deeper insight into the topic!

Collapse
 
rafaacioly profile image
Rafael Acioly

I really like Django but I think that we can't compare with Laravel, laravel ecosystem, features, and documentation are the best out there.

Collapse
 
nishantwrp profile image
Nishant Mittal

I don't think it has the same amount of batteries included. Plus I personally feel that Python outperforms PHP in terms of the amount of third-party packages, learning, etc.

Collapse
 
dollardhingra profile image
Dollar Dhingra

Yes, laravel has a great ecosystem and documentation. In terms of performance, however, Laravel doesn’t compare to Django, which might be a drawback for massive projects

Collapse
 
skorrborg profile image
steve-orr

I have done a lot of Django and a lot of Flask. I was an early adopter of Django going back to shortly after its initial release... Then I found Flask which I strongly prefer. When I have a choice I use Flask. There's a reason that FastAPI was based on Flask then created it's own Flask-like framework.

Now some may say that an API-only solution is a special case to a web-dev framework. That is true, but there are oh so many such "special cases" that are better and more elegantly solved with frameworks where you get to make significant architectural/design decisions yourself. You don't have to just resort to or settle for the "Django monolith." (I was recently shocked when someone gave Django the dreaded "monolith" designation. True that.)

It must be conceded that Django is tightly wedded to SQL. As Joost mentioned, Django generates terrible queries. That being the case I believe it is incumbent on the professional developer to be thoroughly competent/expert in SQL. I confess my bias here as a former DBA. It should be second nature for us to write performant queries. SQLAlchemy is great but I rarely need it. Having to tune/monitor queries with SQLAlchemy is a pain. Sure, I can write custom queries for SQLAlchemy, but when I find myself constantly working-around SQLAlchemy in this way it begs the question, why use it? I have created a great many websites and webapps with Flask. There's nothing that Django does that can't be done better with Flask.

I know SQL. I know Python. I know HTML. I know CSS. I know JavaScript. I know templating. I know how to design and build systems without having to resort to a monolith. I have found that learning how to do these same things in Django takes more time than just doing it directly without Django. In this context Django much less intuitive. Besides, there are a great many 3rd party packages for Flask which you can plug-and-play and/or customize/tweak to just get stuff done. Finally, developers should be able to address performance beginning with the alpha release.

I want to be a DEveloper, not a DUHveloper.

The only reason that I continue to do Django is because of its widespread adoption. As a freelance contractor I'm a "technical whore" where I profess love to those who pay me well. :-)

Collapse
 
yuhuishishishi profile image
I love integers

It is really friendly to use to bootstrap your ideas. This is quite important at the early days of your startup.
Personally I am not worried about its query optimization or performance since you probably never get a chance to think about it before you bring your company out of survival mode.

On the other side, the features provided - ORM, authentication, admin, rest-framework ... these help a company with a limited handful of engineers a lot.

Collapse
 
aspraveen profile image
praveen

I too use both django and laravel.. both are great frame works..

Collapse
 
calag4n profile image
calag4n

Django is great as long as you work with SQL database.
It comes very tricky with NoSQL DBs and it can't really use the power and the ease of embedded objects.