Python Learning Path 8

Source: Internet
Author: User

1. Web Framework

Mvc
Model View Controller
Database template file Business processing


Mtv

Model Template View
Database template file Business processing


############## Web:mvc, MTV

2. Django

PIP3 Install Django


C:\Python35\Scripts

# Create a Django project
Django-admin startproject "project name"

MySite
-MySite # To configure the entire program
-Init
-Settings # configuration file
-URL # URL correspondence relationship
-Wsgi # Follow Wsig specification, Uwsgi + nginx
-manage.py # Managing Django Programs:
-Python manage.py
-Python manage.py Startapp xx
-Python manage.py makemigrations
-Python manage.py Migrate



# Run the Django feature
Python manage.py runserver 127.0.0.1:8001


Chouti
-Chouti
-Configuration
-Main Station app
-Manage apps in the background



# Create App
Python manage.py Startapp CMDB
Python manage.py Startapp OpenStack
Python manage.py startapp xxoo ....


App
Migrations Data modification Table structure
Admin Django provides us with background management
Apps Configure the current app
Models ORM, writes the specified class by command to create a database structure
Tests Unit Test
Views business code



1. Path to the configuration template

TEMPLATES = [
{
' Backend ': ' Django.template.backends.django.DjangoTemplates ',
' DIRS ': [Os.path.join (Base_dir, ' templates ')],
' App_dirs ': True,
' OPTIONS ': {
' Context_processors ': [
' Django.template.context_processors.debug ',
' Django.template.context_processors.request ',
' Django.contrib.auth.context_processors.auth ',
' Django.contrib.messages.context_processors.messages ',
],
},
},
]
2. Configure the static directory
Static

Staticfiles_dirs = (
Os.path.join (Base_dir, ' static '),
)


<link rel= "stylesheet" href= "/static/commons.css"/>

Python Learning Path 8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.