One 、Python Web And Django The world of
=========================
1. Django What is it?
Django It's a framework , For developing websites , The programming language used is Python, stay Django Common development templates are provided in , Let the programmer focus on the business part .
Djano advantage :
More , You have to learn before you can have a deep understanding of .
Django Because it's mainstream Python Web frame , So support MVC Pattern , about MVC It's easy to fall into concepts at the beginning of learning , Here's a simple explanation of the eraser .
MVC It's an abbreviation of three words , Namely (Model -View - Controller), The model is very mature Web Application design patterns .
MVT yes Djongo The design pattern that comes with in , It is associated with MVC There are some differences , You can simply understand it as Django Bring it with you HTML Template file , And support template language ( The blog behind the template language will cover , Include placeholders , Branch , Circulation and other common operations ),Django Nothing is lost Controller, It's just that it does it on its own , It doesn't require too much developer involvement .
be based on Python Linguistic Web There are a lot of frames , Common are Webpy、Flask、Bottle、Pyramid、Tornado. The third round of snowballing is mainly about Djando, Framework is a powerful tool to improve the efficiency of code writing , You can start with any learning , choice Django It's just that the frame reform is more popular in China , Pay attention to , There is no distinction between good and bad in terms of framework .
2. Web Develop the front knowledge
Front end knowledge
Front end knowledge includes HTML,CSS,Javascript , Hope to learn complete Web Development of students , This part of knowledge must be supplemented completely , It's very good for you , If there's a chance later , The eraser will do a separate set Web Front end column series .
HTTP Deal with the TCP/IP agreement
Web Development follows HTTP Protocol implemented , Therefore, this part also belongs to the necessary knowledge , Network protocol TCP/IP In the early stage of learning, we can post .
Linux Server knowledge
At present, the mainstream servers in China are Linux System , Although in Windows Up operation Python No problem at all , But take a long look , It is recommended to master Linux Server related knowledge .
Database system
As a Python R & D personnel , This part of knowledge cannot be omitted , In especial MySQL database , besides , To master skillfully SQL Language , It's also the top priority .
Cache system
Give priority to Redis
Data structures and design patterns
The core competitiveness of programmers , At the beginning of learning, it can be put behind , Including algorithms .
Operating system principle
A course in College , I believe many students have forgotten , Here's just a reminder , If you want your own way of programming , Farther away , It is suggested to supplement the knowledge of operating system principles .
3. Web Development of Python part
This column belongs to snowballing Python Extension of , therefore Python Relevant pre knowledge has been learned in the snowball .
4. These foundations , Do you have any impression ?
divmod
, Do you know how to use it ?collections.OrderedDict
What does it do ?collections.deque
Have you ever studied ?os
Can a module be imported into a module ?__
What does the underline mean ?_
What does the underline mean ?exec
,eval
,repr
What do the three built-in functions do ?pickle
、json
、shutil
How to use the module ?5. Django Installation and operation
install Djando It's very simple , Use the command line to install .
pip install django
The installation is successful. The contents that appear are :
Successfully installed asgiref-3.3.1 django-3.1.7 sqlparse-0.4.1
After installation, use the following code to test :
import django print(django.get_version())
In the test environment variables are completely correct , Run the following command in the command window :
django-admin help
If everything is consistent with the picture above , You can continue to use the following command , Create a Django project .
django-admin startproject my_website
After running , Generate the following file structure in the corresponding folder .
stay my_website
Another directory contains my_website
Catalog , The directory is the entire project's configuration file directory , also manage.py
file , Project management script .
my_website
my_website
__init__.py
asgi.py
: ASGI Server deployment information setting.py
: Project configuration information urls.py
: Website routing information wagi.py
: Deployment information manage.py
Use in command line cd
Enter into my_website
Catalog , Run the following command again :
python manage.py runserver
Open browser access :http://127.0.0.1:8000/, Get what's shown in the figure below , Express Django Already open .
During operation , You can also specify ports , For example, the following command :
python manage.py runserver 8080
Use Ctrl+C
Out of Service .