DEV Community

loading...

5 Reasons to use Django, the Python web framework

Fabien Schlegel
Web Developer | ReactJS | Django
Originally published at devoreur2code.com ・3 min read

Django is a Python framework for web development. These are the five reasons why you should use it.

Faster Development

Python is really easy to learn. It is usually first language of choice for developers.

Django follow Python philosophy as DRY (Don't Repeat Yourself) and Batteries Included (Almost of your needs are covered by the framework itself).

It can be confusing at first, but Django handles a lot of stuff under the hood. So you don't worry about the details and it gets the job done.

For example, migrate your data need in the majority of cases, only two commands.

python manage.py makemigrations
python manage.py migrate
Enter fullscreen mode Exit fullscreen mode

When more it's needed, Django provide help to integrate new fields, like default value.

Django included it's own ORM (Object Relational Mapping) to deal with the database.

There is a lot of included features like internationalization, routing, security, etc.

Documentation

The documentation of the framework is always up to date,  covers all the supported versions. It contains an how to tutorial really detailed. Everything you need is accessible and you can easily inspect Django source code.

All major additional libraries follows the same guide lines, like Django Rest Framework.

Because Django is popular and used worldwide, sites like Stack Overflow are flooded with Django content.

Admin

With Django, create a project, add some models and remove comment for the admin path.

It's all you need to have an admin interface to manage the data.

And believe me, that's a huge advantage over other frameworks, it's will save you a lot of time.

Scalability

Scalability can be important when it comes to developing web apps. Django includes a series of default components that can be unplugged and replaced for more specific solutions, to handle scalability without efforts.

What is more, Django lets you use plugins to extend your web app, and there are countless packages available to help you scale up your product.

Community

The community is huge. There are active developers in the community who develop great plugins to make app development easier.

With the code being open-source, you can speed up development by modifying easily available resources. If you run into any difficulties with your project, you can count on the Django community to help you with your projects.

When to not use it

Even I have a high opinion about Django, like each framework or language, it's not the right answer in all cases.

For example with a very basic app, Django is overkill. A front end framework with Firebase may be enough. And for a small API, you can use Flask instead of Django and Django Rest Framework.

The resources that have really helped me

Conclusion

The learning curve for Django is low, and if you don't know Python, it's a good way to learn it.

Now I use Django as a REST API with React as front end. You can create powerful and reliable app with this couple of frameworks.

I hope this post will make you want to try Django.

You want more content about Django or Python ? Feel free to ask me on Twitter

Discussion (3)

Collapse
detzam profile image
webstuff

you can use DRY in any programing language.
now as speed.... this approach is for custom stuff, sorry but php has more crms that you can use to speed development of some presenation or shop website application.
Now security wise, i accept that python should be better and that if you built something , you can reuse it in future project, but until you create sed application you'll lose hundreds of hours.
thats my oppinion

Collapse
adwaithrajesh profile image
Adwaith Rajesh

If I want to make a REST API, just an api no frontend which is better django rest framework or flask restful

Collapse
le_humch profile image
Fabien Schlegel Author

Flask is a "micro framework", you have to add most of the features by yourself.

For a public REST API, with not too much endpoints, no sessions management, use Flask restful.

If you need : sessions, users authentification, database ORM, security like CSRF, minimal requirements for passwords, admin UI and many of others things already included, Django and DRF is the right choice.