Django's Wsgi and MVC/MTV

Source: Internet
Author: User

The nature of the Web framework: Socket accept request + content processing + socket response.

But Django doesn't have a socket to use other Socket+django

The socket has many of the following

But they must follow a specification WSGI (Web Services Gateway Interface)

Django uses WGIREF sockets by default (low concurrency performance test)

Uwsgi+django in the work

Wsgiref +django Work Flow

1.socket Accept client requests for HTTP request parsing (Split request header request body)

2.wsgiref forward the parsing request related information to Django

3.Django execution processing, return output string, back to Wsgi

4. Send the socket (the Django output character string) back to the client

wsgi+Django fromWsgiref.simple_serverImportMake_serverdefrunserver (environ, start_response): The Django framework begins the middleware routing system view                                Graph function ..... Start_response ('OK', [('Content-type','text/html')])                                                return[Bytes ('', encoding='Utf-8'), ]                                      if __name__=='__main__': httpd= Make_server ('127.0.0.1', 8000, Runserver) httpd.serve_forever ()
View Code

Mvc/mtv

Is there someone who often put B in front of you to mention MVC and MTV?

The white is to do function module division, put different code to different files.

Mvc

Models (database, model)

Views (HTML Template)

Controllers (Business logic processing)--MVC

Mtv

Models (database, model)

Templates (HTML template)

Views (business logic Processing)--MTV (Django belongs to MTV)

Django's Wsgi and MVC/MTV

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.