Table of Contents
Django is a high-level Python web framework for building secure and scalable web applications quickly. It uses the Model-View-Template (MVT) pattern, provides an ORM for database access, an automatic admin panel, and built-in authentication. With its “Don’t Repeat Yourself” philosophy and strong community support, Django makes developing modern web apps faster and more maintainable.
A Django project is considered a project. And under this project, it has many apps. For example, you want to build a social media app, and this app has many features: comments, follow, share, etc. In this example, the social media app is considered a project, and each different feature is considered a different app.
A project structure can be like this:
myproject/ <-- project root folder
│
├── manage.py <-- command-line utility to run/maintain project
│
├── myproject/ <-- inner project folder (same name as root)
│ ├── __init__.py <-- marks as a Python package
│ ├── settings.py <-- main configuration: DB, installed apps, etc.
│ ├── urls.py <-- URL routing (maps URLs to views)
│ ├── asgi.py <-- entry point for async servers (Daphne, Uvicorn)
│ └── wsgi.py <-- entry point for WSGI servers (Gunicorn, etc.)
│
└── venv/ <-- (optional) your virtual environment
Key Difference
Example:
If you’re making an E-commerce website:
ecommerce_site (global settings, URLs).products (list and manage products)cart (shopping cart)orders (checkout & payments)users (accounts & profiles)Django recommends running on a Python virtual environment. Here is how to set up: