• Powerful templates: Django includes a template engine that makes it easy to display data dynamically.
The tree structure of a Django project
• The Django project tree is well organized to facilitate code structuring and maintain a clear, modular architecture.
1. Project Root
• manage.py :
• Main script for interacting with the Django project.
• Allows you to launch the server (runserver), perform migrations (migrate), create an application (startapp), etc.
3. Main project folder (project_name/)
• __init__.py :
• Indicates that this folder is a Python package.
• settings.py :
• Contains project configuration settings (database, installed applications, security, static files, etc.).
• urls.py :
• Defines the main routes of the application.
• wsgi.py :
• Script used to deploy the application with a WSGI compatible server (e.g. Gunicorn).
• asgi.py :
• Script used for deployment with asynchronous protocols like WebSockets.
•
3. Applications (app1/)
Each application represents an independent feature or module in your project.
• migrations/:
• Contains migration files generated by Django to handle schema changes in the database .
• admin.py :
• Allows you to customize the Django administration interface ( adding models , configuring displays, etc.).
• apps.py :
• Contains the application configuration.
• Example : the name of the application or specific settings .
• models.py :
• Contains model definitions ( database tables ) .
views.py :
• Contains the business logic of the application.
The tree structure of a Django project
• wsgi.py :
• Script used to deploy the application with a WSGI compatible server (e.g. Gunicorn).
• asgi.py :
• Script used for deployment with asynchronous protocols like WebSockets.
•
3. Applications (app1/)
Each application represents an independent feature or module in your project.
• migrations/:
• Contains migration files generated by Django to handle schema changes in the database.
• admin.py :
• Allows you to customize the Django administration interface (adding models, configuring displays, etc.).
• apps.py :
• Contains the application configuration.
• Example: the name of the application or specific settings .
• models.py :
• Contains model definitions (database tables).
views.py :
• Contains the business logic of the application.
tests.py :
• Used to write unit tests for the application.
urls.py (to create):
• Defines application-specific routes.
templates/ :
• Contains the HTML files for this application.
static/ :
• Contains static files like CSS, JS or images for this application.