Getting started with Django

Source: Internet
Author: User
Tags install django
1 web application 2 C/S and BS architecture 3 Web framework in Python A: Socket B: Matching Relationship Between routing and view functions C: Template rendering DJANGO:: using someone else's wsgiref B: Self-written C: Self-written flask: A: using someone else's B: Self-written C: using someone else's: jinja2 tornado: A self-written B: Self-written C: Self-written 4 http:-features: 1 application layer protocol based on TCP/IP protocol 2 Request-response mode 3 stateless storage 4 connectionless-request format:-response format: 5. install and use Django easily-install: 1 pip3 install Django = 1.11.9 2 pycharm, select the version number-run: Command to create a project: Django-Admin startproject project name to create an app: python3 manage. PY Startapp app01-file directory Description:-manage. PY --- project portal, execute some commands-project name-settings: global configuration information-urls: total route, ing between request address and view function-app name-migrations: database migration record-models. PY database table model-views function-run project: pytyon3 manage. PY runserver 127.0.0.1: 80016 supplement: 1 decode and encode data = B '000000' DATA = STR (data, encoding = 'utf-8') print (type (data )) data = bytes (data, encoding = 'utf-8') print (type (data) 2 pymysql link database # Get the database link conn = pymysql. connect (host = '2017. 0.0.1 ', Port = 3306, user = 'root', DB = 'lqz', password = 'admin') # obtain the cursor and the query result data is in the dictionary format cur = Conn. cursor (pymysql. cursors. dictcursor) # run SQL cur.exe cute ('select * From user') # obtain all query results DIC = cur. fetchall () 3 Write project: 1 do not use Chinese 2 computer name cannot use Chinese 3 A Project is a project

Getting started with Django

Related Article

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.