DJANGO

Create by Nguyen Tuan Kien

Outline

  1. Tổng quan  về Django
  2. Django - MVC frameworks
  3. Tạo một ứng dụng Django đơn giản
  4. Cấu trúc một ứng dụng Django
  5. Ưu điểm và nhược điểm
  6. So sánh DjangoLaravel

1. Tổng quan về Django

Django(/ˈdʒæŋɡoʊ/ jang-goh) là một framework mã nguồn mở để phát triển các ứng dụng web được viết bằng ngôn ngữ Python.

Adrian Holovaty

Simon Willison

1. Tổng quan về Django

1. Tổng quan về Django

Một số web application được xây dựng bằng Django.

2. Django - MVC framework

Django là một MVC(Model - View - Controller) framework

Tuy nhiên,do Controller được Django xử lý,nên thực chất framework theo mô hình MTV(Model - Template - View)

  • Models

          Describes your data structure/database schema

  • Views 

​          Controls what a user sees

  • Templates

​          How a user sees it

  • Controller

​          The Django Framework - URL parsing

2. Django - MVC framework

2. Django - MVC framework

Django Modules

  • Administration interface (CRUD interface)
  • Authentication system
  • Comments system
  • Forms handling
  • Sessions
  • Syndication framework (RSS and Atom Feeds)
  • Caching
  • Internationalization
  • Localization
  • Custom Middleware

3. Tạo một ứng dụng Django đơn giản

Steps to create New Project

  •  Create a project
  •  Start an application
  •  Create the database (MySQL, Postgresql, SQLite)
  •  Define DB Settings in settings.py
  •  Define your models
  •  Add pluggable modules 
  •  Write your templates
  •  Define your views
  •  Create URL mapping
  •  Test Application
  •  Deploy Application

4. Cấu trúc ứng dụng Django

MySite/

  •  __init__.py
  •  manage.py // Script to interact with Django
  •  settings.py // Config
  •  urls.py$ // My Site URL mapping
  •  MyProject

                __init__.py

                urls.py // Project specific URL mapping

                models.py // Data Models

                views.py // Contains the call back functions

                admin.py

                templates

5. Ưu nhược điểm của Django

Ưu điểm

Nhược điểm

6. So sánh Django và Laravel

Why I choose Laravel to compare?

Because Laravel is my 1st framework . And I only learn Django and Laravel.

VS

deck

By Tuấn Kiên Nguyễn