程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Django (I)

編輯:Python

Django

One 、 First time to know

1) Introduce

django yes web Application framework

2)web Application framework

Internet delivery data Information Power grid delivery electric

3) Web application

power plant -----》 Server program (Nginx、apache) Web Application essence — Program — Server program + Applications

4)
  1. Applications — Electrical appliances

  2. WSGI---- Power module

  3. Web frame

    Web application — Make electrical appliances

    Web frame — The basic principle

    \1. There are different brands of electrical appliances ,web So is the framework

    Django Omnipotent web frame

    Web.py Compact web frame

    Flask.py A lightweight excellent web frame

    Tornado An asynchronous web frame

Two 、 Design patterns

1)MTV
-m :models Model : Responsible for business data objects and database objects
-t : template Templates : Responsible for showing the page to users (html)
-v :view View : Bridge between model and formwork

2)MVC

-m :models Model : Responsible for business data objects and database objects
-v : view View : Pages that interact with users
-c : controller controller : Receive user input , Call the model and view to complete the user's request , A bridge between models and views
``
#### 3、 ... and 、 Environment building

1) View the current virtual environments Workon

2) Creating a virtual environment mkvirtualenv -p /usr/bin/python3 djangoApp

3) Exit virtual environment :deactivate

4) Delete virtual environment :rmvirtualenv djangoApp

Virtual machine creation Django

5、 ... and 、 Project creation

1.mkvirtualenv -p /usr/bin/python3 djangoApp
2.pip install django==2.1.7
3.Cd The name of the folder where the project file is stored
4. Choose a generic way to create a project independent of the editor version ----》 command django-admin startproject ( Project name )
5.python manage.py runserver 0.0.0.0:8000

6、 ... and 、 To configure pycharm Remote synchronization of

1) To configure

1.pycharm Create a new empty project locally
2. Configure remote interpreter ( Be careful : Consistent with the project interpreter )
3. Modify the file mapping path
4. Set up automatic synchronization

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved