To Django or to DjangoREST?

Barbara Streisand
Release: 2024-11-03 14:45:30
Original
222 people have browsed it

To Django or to DjangoREST?

Django and DjangoREST are high level frameworks in Python that might be argued on whether they are different, so are they?. DjangoREST is used for building API's(Application Programming Interface) while Django for web apps.To leave it at that though would leave one with a conclusion and so lets explore further.
What is Django?
It is a high level framework that follows the Model-View-Template(MVT) pattern. It handles both front-end and back-end development providing features for a standard web app. Utilises the Object-Relational Mapping(ORM) simplifying database interactions and adhering to the DRY(Don't Repeat Yourself) principle.
Handles URL routing, template rendering, database management. It is tightly coupled with django templates.
What is DjangoREST?
An extension of Django framework specialized for API's. Data is returned in json format, the API standard. It leverages Djangos abilities to facilitate development of scalable, maintainable and secure API's.
It adheres to Django's principles like DRY and strongly emphasize code reusability and modularity.
So really whats the difference?
There really is no difference but instead one only needs to understand what they wish to accomplish.
i) DRF(DjangoREST Framework) offers scalability capabilities for example when your web app becomes popular and now you need an app, it makes it easy to switch over.
With Django one would need to create a whole other back-end and make migrations on the user data. This can be time consuming and resource intensive.
ii) When there is multiple teams, frontend and backend, working on a system, DRF makes it easy.The backend team can work on the backend while the frontend can work with frameworks and utilize axios to hit urls.
iii)If you are looking to create a standard and simple web app, Django offers inbuilt templating languages.When you need to use frontend frameworks like Angular or React then DRF makes it easier to integrate them.
Conclusion
There is no difference between Django and DRF(Django Rest Framework), while one renders templates and the other data in json format. It waters down to the projects specific needs and goals
Although this can be seen as a difference, It is truly only clear that one is an extension of the other and the difference lies in understanding what you want to accomplish.

Further read and references:
Django
Django-Rest-Framework
StackOverflow

The above is the detailed content of To Django or to DjangoREST?. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!