Django and Django Rest Framework: Best Practices 2021

  • Model classes provide an object-relational map (ORM) for the underlying database. A model is mapped to a table in the database. You can query the databases without any SQL programming. With models, it’s easy to define tables and relationships between them.
  • Views are in charge of the process of requests. They function as controllers. You can implement them in many ways, such as functions or classes.
  • Serializer classes provide control of data types and structures of requests and responses. I like to define them as interfaces for the backend of the web app.
  • Templates are files with static and dynamic content. They’re made up of some static code and other elements that depend on the context.
  1. Scaffolding and configuration structure: Any person who is new to development can easily create an application with ease using django’s framework. It is vital to create a structure that is easy to maintain and reuse it whenever required.Whenever you use Django, it generates a settings.py file which contains all the details related to the project.So it is advised not to make any changes in the main settings file and generate new files for different environments.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
MicroPyramid

MicroPyramid

1K Followers

Python, Django, Android and IOS, reactjs, react-native, AWS, Salesforce consulting & development company