CREATING & UNDERSTANDING DJANGO PROJECT STRUCTURE
1. Create a Django Project
- Create a new Django project named
new_project:
django-admin startproject new_project

- Get into the Project directory
cd new_project

2. Project-Level Files
manage.py
-
- Entry point for Django commands such as
runserver,migrate, andcreatesuperuser.
- Entry point for Django commands such as

settings.py
-
- Contains project configurations like database settings and installed apps.
- Key sections:
INSTALLED_APPS: Lists all enabled Django apps.

-
-
DATABASES: Defines database configurations.
-

urls.py
-
- Defines URL patterns and routes them to views.
- Example:

wsgi.py
-
- Entry point for WSGI-compatible web servers to serve your project.

asgi.py
-
- Entry point for ASGI-compatible web servers, supporting WebSockets and asynchronous tasks.

3. App-Level Files
Create a new app named home:
python manage.py startapp home
views.py
-
- Contains the logic for processing requests and returning responses.
- Example:

models.py
-
- Defines the database structure using Python classes.
- Example:

admin.py
-
- Registers models to be managed via the Django Admin interface.
- Example:

apps.py
-
- Contains metadata for the app.
migrations/
-
- Stores migration files to manage database schema changes.
- Can be updated using inbuilt command
makemigrationsusing manage.py.
20
