SwadhyAI Notes

All Python notes

Django Tutorial 🌐

The Web Framework for Perfectionists

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It follows the MVT (Model-View-Template) architectural pattern.

🏗️ MVT Architecture

  • Model: Defines the data structure (Database).
  • View: Handles the logic and user interaction.
  • Template: Handles the presentation (HTML).

✨ Key Features

Admin Interface

Built-in, ready-to-use admin panel for managing content.

ORM

Object-Relational Mapper allows you to interact with databases using Python code instead of SQL.

Security

Protects against SQL injection, XSS, CSRF, and clickjacking.

Scalability

Used by Instagram, Pinterest, and Mozilla.

🚀 Quick Start

Terminal
# 1. Install Django
pip install django
 
# 2. Create Project
django-admin startproject mysite
 
# 3. Run Server
cd mysite
python manage.py runserver

💡 Did You Know?

Django was originally developed to manage the website of a newspaper in Lawrence, Kansas.