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