Pros and Cons of Django

Note perev .: This article is intended mainly for those who are just choosing a framework for web development. Experienced Django developers are unlikely to learn anything new.

















Django is described as "a web-based framework for perfectionists with deadlines." It was created to move from prototypes to ready-made services as quickly as possible.







The framework will help develop a turnkey CRUD application. Django doesn't have to reinvent the wheel. It works out of the box and allows you to focus on business logic and products for ordinary people.







Pros of Django



The principle of "all inclusive" ("Batteries included")



The phrase “all-inclusive” means that most of the tools for creating an application are part of the framework, and do not come in separate libraries.







Django contains a huge amount of functionality to solve most web development tasks. Here are some of the high-level features of Django that you will have to look for separately if you prefer a micro framework:









Standardized structure



Django as a framework defines the project structure. It helps developers understand where and how to add new functionality.







Thanks to the same structure for all projects, it is much easier to find ready-made solutions or get help from the community. A huge number of enthusiastic developers will help to cope with any task much faster.







Django Apps



Applications in Django allow you to split a project into several parts. Applications are installed by adding to settings.INSTALLED_APPS . This approach makes it easy to integrate turnkey solutions.







Hundreds of universal modules and applications will greatly accelerate development. Take a look at their list at djangopackages.org .







Safe by default



Django is secure out of the box and includes mechanisms to prevent common attacks such as SQL injection (XSS) and cross-site request forgery (CSRF). You can read more about this in the official security manual .







REST Framework for creating an API



The Django REST Framework, often abbreviated to “DRF,” is a library for building APIs. It has a modular and customizable architecture that works well for creating both simple and complex APIs.







In DRF, authentication and permission policies are available out of the box. It comes with base classes for CRUD operations and a built-in utility for testing the developed API.







GraphQL API framework



Large REST APIs often require a large number of requests to get all the necessary data. GraphQL is a query language that makes exchanging related data much easier. Read more about the basic concepts of GraphQL in the official documentation .







Graphene-Django makes it easy to add the appropriate functionality to your project. Django's models, forms, authentication, permission policies, and other functionalities can be used to create the GraphQL API. The library also comes with a utility for testing the result.







Disadvantages of django



Django orm



Django ORM today is significantly inferior to the latest SQLAlchemy.







Django ORM is based on the Active Record template, which is worse than the Unit of Work template used in SQLAlchemy. In practice, this is expressed in the fact that in Django models can “save” themselves at will, and transactions are disabled by default. You can read more about this in the article “Things I Don't Like in Django” .







Django is developing slowly



Django is a large and monolithic framework. This allows the community to develop hundreds of generic modules and applications, but slows down the development speed of Django itself. In addition, the framework must support backward compatibility, so it is developing relatively slowly.







Bottom line: should I choose Django?



Although Django ORM is not as flexible as SQLAlchemy, and a large ecosystem of reusable modules and applications slows down the development of infrastructure, obviously Django should be the first candidate for the role of a python framework.







Alternative lightweight frameworks like Flask, although they allow you to be freer than Django in the ecosystem and configuration, may require extra time to search / create additional libraries and functionality in the long term.







The stability of Django and the community around it has grown to unimaginable sizes since its first release. The official documentation and tutorials on the framework are some of the best of their kind. And with each new version of Django continues to grow opportunities.








All Articles