Code structuring for Django projects
When we start a new project in Django, the Django management command creates the basic files needed to create our Django project. In Chapter 1, we learned how we can set up our Django project and create different Django apps. In this section, we shall collate all the information we have gathered in previous chapters on using different files for different purposes in Django.
Creating files as per functionalities
As a first step in bifurcation, we have already learned that we should create multiple Django apps in our Django project. The splitting of a Django app depends on the business logic functionalities; for example, our blogging project can have blog
and author
as two different Django apps. Inside each app, we would split our code into multiple files. Here is the recommended list of files we should consider while working on Django:
urls.py
: Each Django application should have aurls.py
file that contains all the routing logic for...