|
1 | 1 | ### Introduction
|
2 |
| -Django is high level Python web development framework |
3 |
| -that helps fast development of secure and maintainable website. |
| 2 | +**Django** is a **high-level Python web framework** that encourages rapid development and clean, pragmatic design. It helps you build secure and maintainable websites quickly, so you can focus on writing your app without needing to reinvent the wheel. π οΈ |
4 | 3 |
|
5 |
| -### Advantage: |
6 |
| -- Fast |
7 |
| -- Secure |
8 |
| -- Scalable |
| 4 | +## Why Use Django? π€ |
9 | 5 |
|
| 6 | +### Advantages β
|
10 | 7 |
|
11 |
| -### Already Build With Django |
12 |
| -- Instagram, nationalgeographic, pinterest, Khalti, Mozilla |
| 8 | +- **Fast Development**: Get your web application up and running quickly! β© |
| 9 | +- **Secure**: Protects against common security threats by default. π |
| 10 | +- **Scalable**: Handles high traffic and large amounts of data gracefully. π |
| 11 | +- **Versatile**: Suitable for all types of projects, from simple to complex. π§© |
13 | 12 |
|
| 13 | +### Built-In Features (Batteries Included) π |
14 | 14 |
|
| 15 | +- **Admin Interface**: Automatically generated admin panel to manage your site. |
| 16 | +- **ORM**: Object-Relational Mapping to interact with databases easily. |
| 17 | +- **Templating Engine**: For dynamic HTML generation. |
| 18 | +- **Form Handling**: Simplifies form rendering and validation. |
| 19 | +- **Authentication**: User authentication system ready to go. |
15 | 20 |
|
16 |
| -### Django Use MVT |
17 |
| -Model: Data Structure |
18 |
| -View: Logic From Model and render to template |
19 |
| -Template: Presentation where data is displayed to user. |
| 21 | +## Real-World Examples π |
20 | 22 |
|
| 23 | +Websites that use Django: |
21 | 24 |
|
22 |
| -### Why Django? |
23 |
| -- All things included [Batteries Included] [Built In] |
24 |
| -- DRY [Don't Repeat Yourself] |
25 |
| -- Community Support |
| 25 | +- **Instagram** πΈ |
| 26 | +- **Pinterest** π |
| 27 | +- **Mozilla** π¦ |
| 28 | +- **Khalti** π° |
| 29 | +- **National Geographic** π |
26 | 30 |
|
| 31 | +--- |
27 | 32 |
|
28 |
| -### Django Alternatives |
29 |
| -1. Flask [Lightweight but need more configuration] |
30 |
| -2. Laravel |
31 |
| -3. Ruby on Rails [Based on Ruby Programming Language] |
32 | 33 |
|
| 34 | +## Understanding Django's Architecture ποΈ |
33 | 35 |
|
34 |
| -### Requirements Install |
35 |
| -1. Python |
36 |
| -2. virtualenv |
| 36 | +Django follows the **MVT (Model-View-Template)** architectural pattern: |
| 37 | + |
| 38 | +1. **Model**: Defines the data structure; it's the database layer. ποΈ |
| 39 | +2. **View**: Contains the logic that interacts with the model and renders a response. π§ |
| 40 | +3. **Template**: Deals with the presentation layer; how data is displayed to the user. π¨ |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Key Principles π― |
| 47 | + |
| 48 | +- **DRY (Don't Repeat Yourself)**: Encourages reusability and clean code. β»οΈ |
| 49 | +- **Convention over Configuration**: Makes decisions for you, so you can focus on your app. π |
| 50 | +- **Pluggable Apps**: Easy to integrate third-party apps or create reusable ones. π |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## Alternatives to Django π£οΈ |
| 55 | + |
| 56 | +While Django is powerful, it's good to know other frameworks: |
| 57 | + |
| 58 | +1. **Flask** π§ͺ |
| 59 | + - Lightweight and minimalistic. |
| 60 | + - Requires more configuration. |
| 61 | +2. **Laravel** π§ββοΈ |
| 62 | + - PHP framework with elegant syntax. |
| 63 | +3. **Ruby on Rails** π |
| 64 | + - Based on Ruby, focuses on convention over configuration. |
| 65 | + |
| 66 | +--- |
| 67 | +## Getting Started π |
| 68 | + |
| 69 | +### Prerequisites π |
| 70 | + |
| 71 | +1. **Python** π |
| 72 | + - Make sure Python is installed on your system. |
| 73 | +2. **Virtual Environment** π |
| 74 | + - Isolates your project dependencies. |
| 75 | +3. **VS Code** π» |
| 76 | + - A powerful code editor. |
| 77 | + |
| 78 | +**Optional:** |
| 79 | + |
| 80 | +- **Chrome Extension for Django** π§© |
| 81 | + - Enhances your development experience. |
| 82 | + |
| 83 | +## Setting Up Your Environment π³ |
| 84 | +### Install Virtualenv |
| 85 | +virtualenv |
37 | 86 | ```bash
|
38 | 87 | pip install virtualenv
|
39 | 88 | ```
|
|
0 commit comments