Django Basic---Web framework and Django Introduction

Source: Internet
Author: User
Tags install django

Web Framework

 CS Architecture Installing a client on each user's computer requires upgrading the BS schema update fast users only need a browser socket --socket-- TCP API socket equivalent Expressway FTP HTTPFTP --Maintain connection---can always send messages to each other---establish a connection--communication--- disconnect http -- short connection Once a conversation comes back Stateless no hold status no identification (who does not know who) --- for the service side are unfamiliar cookie session authentication Blog Park Socket Server start Service Listener client request own browser socket Client connection /c1>http request:  get post  get/http/1.1 Host:www.hao123.com connection:keep-alive pragma:n  O-cache cache-control:no-cache upgrade-insecure-requests:1 user-agent:mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/58.0.3029.110 safari/537.36 accept:text/html,application/xht ml+xml,application/xml;q=0.9,image/webp,*/* ; q=0.8 accept-encoding:gzip, deflate, SDCH, BR accept-language:zh-cn,zh;q=0.8 cookie:flashid=4 4e88b0f2afbf4753cb89ede14id=de0aid=610 header \ r \ n \ \ \ Body Content http Response: Response http/1.1 OK # Protocol and status Connection:keep-alive container:20808 30.hz_hao123_online_3754 Content-encoding:gzip content-security-policy-report-only:default-src htt PS: ' unsafe-inline ' unsafe-eval ' data:; Report-uriHttps://reports.baidu.com/csp-reportContent-type:text/html;charset=utf-8 # Response content Cxy_all: +BACC561462B9208869A2D59F3D961EF1 Date:fri, 02:10:27 GMT lfy:hz01.47815 public-key-pins-report-only:max-age=30 0;pin-sha256= "k87owbwm9uzfyddvdfoxl+8lpnyoub2ptgtn0fv6g2q=";p in-sha256= "iqbnnbeifuhj+8x6x8xlgh01v9ic5/ V3irqlnffc7v4= "; report-uri="https://reports.baidu.com/pkp-report/"Server:apache set-cookie:org=1; Expires=fri, 24-nov-2017 15:59:59 GMT set-cookie:v_pg=s_4%2cs_33%2cs_36 Set-cookie: __bsi=124521525 09627802100_00_100_r_r_322_0303_c02f_y; max-age=3600; domain=www.hao123.com; path=/tracecode:06269793181026478346112410 tracecode:06268277950916247050112410 Vary: Accept-encoding transfer-encoding:chunked http/1.1 OK # Protocol and status header (can Blank line) \ r \ n \ r \ http/1.1 The body content Hello Ok\r\ n\r\n Hello uses the specific URL of the request header to determine the return of different content URL DNS resolution---IP port Web default port is


======================================================================

A complete web framework

1 Socket Service side

2 different functions are implemented according to different URLs .

3 Returning content to the client

Template Render String substitution


Python framework

Tornada 1+2+3 Third party's service side + third party return content + third party URL logic

Django Chatty third-party server + self-written return content + self- written URL logic

Flask Small and beautiful third party service side + third party return content + self-written URL logic


Web application Web server WSGI protocol



About Django

#  Django Installation

PIP3 Install Django

# Create a Django project

django-admin.py startproject mydj manage.py-----a tool inside a Django project that can invoke a Django shell and database. settings.py----contains the default settings for the project, including database information, debug flags, and other work variables. urls.py-----responsible for mapping the URL pattern to the application. wsgi.py-----WSGI Protocol Web application Web server WSGI protocol Django does not need to write a socket---URL---the relationship request (return content) page represents the relevant content for all requests1Request.method2Request. POST.Get("Key") Novice Three-piece set: fromdjango.shortcuts Import HttpResponsereturnHttpResponse render (reqeust,demo.html,{{}}) redirect Template language: {% forIinchxx%} {{i}}{% ENDFOR%}{{Variable name}}html file Address dir config static file css picture address configuration comment out SRFV



Django Basic---Web framework and Django Introduction

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.