Django is an extensive framework of the language Python. Therefore, on this note, it should not be surprising that a Django project will include many significant files and folders if needed. This article will address the default folders and files provided by Django.
You might want to read this article of mine, How to Create a Django Project and Project, for the project sample that will be examined in this article or, better still, clone it from the GitHub website Django sample project.
Image of the Project
Below is an image of the Django project and application. Specifically, this is the project's image from a code editor, VSCode.
This is a Django application folder, and it is possible to have more than a Django application based on the project's scope, but our sample project is one application-based. It hosts all the files and folders related to the application and even more, if the files are imported into other applications.
This is the folder where the schema files for creating and updating a database are kept. This is the command for making migrations.
python manage.py makemigrations
The Init file
An experienced Python developer should know the work of this file. It is a Python file that marks a directory as a Python package. It is used to initialize the package when imported(i.e., it helps connect files from a Django folder/ application to one another).
This file is for displaying your models on the project admin page. It is always in a Django application by default. It makes it easy for one to test models using a page/form created by the Django framework.
The Admin file
The Models file
This is where you carve the tables and schema for the project and application database.
The Tests file
For writing tests, check for errors and see that the codes run perfectly.
Check one of my articles on Why Write Tests?
The Views file
The File for the application functions and rendering/ displaying data content on the project web application.
The folder that hosts files and folders related to the project in general. All applications in the project must be connected to this folder.
The Pycache folder
This folder consists of interpreted and optimized versions of codes. When executed, it converts to bytecode and ends with either a
The Asynchronous Server Gateway Interface (ASGI) file
It is for sending requests to asynchronous-capable Python programming language frameworks and applications. It allows developers to write web applications that can handle multiple requests at once without blocking the main thread.
The settings file
This file is where the major configuration of the project and application resides; without it, the project will be unable to run.
The URLS file
This file connects all the URL files in the application folder together. It provides different and unique major URL patterns (parameters) for the project.
The Web Server Gateway Interface (WSGI) file
It is a mediator responsible for communicating between a web server and a Python web application. It explains how the web server communicates with the app and how it can be chained to process a request.
The SQLite Database.
The database of the project. It is where the database schema is located.
The Manage file
This file powers and engineers Django-based commands when written from the command line(e.g.,
python manage.py runserver,
python manage.py createsuperuser).
I hope you were able to understand more about the Django project and application folder and file, structure and architecture.