The article contains columns
—Django from ( Easy tutorial with pictures and texts ) special column —!!Content :
《Django Chapter II addition, deletion, modification and investigation 》
1. Take care of everything django( Known as the integrity of the framework )
2. Strive to streamline web.py and Tornado
3. The Cenozoic era is the framework Flask and Bottle
In order to improve our efficiency in completing the project , We will use some of the lowest and most basic in the project
Foundation ( The main structure of the program , The skeleton of the program ) Pack your things into semi-finished products , And beat these
The half layer of the package is the frame .
Advantages and disadvantages of framework : Code can be reused 、 mature 、 steady 、 Easy to expand 、 Easy maintenance
django by MVT Model (templates - view - model)
M:Model, Responsible for interacting with the database , Build a model
V:View, View layer , Accept page requests , Respond
T:Template, Templates , It is writing html、css、js Templates , Generally speaking, it is what is displayed in the web page
First you need to download python The latest version , You can download it directly on the official website , Using shortcut keys
windows+r Enter... In the run interface cmd, open Task manager
Type in
pip install django
You can download it. django The latest version among (pip yes python Management pack tools , You can
pip install , uninstall , to update . see django edition :
stay cmd In Task Manager Input :python Press enter to enter python Interactive systems , And enter the :
import django
django.get_version()
exit()
Pictured :
You can display its version , among get_version() Equivalent to a view version of the function
exit() sign out python shell
Example : Let's go to the desktop in the task manager , And enter the ( The last one demo It's custom
The righteous , You can name anything )
django.admin startproject demo
You can see that the desktop generates a file , Double-click to open
There's a demo There's another one in the file manage.py( This is used to run )
Double click in demo The following documents are included after the document :
__init.py__: Tell the system that this is a problem python package,django Configuration of miner
setting.py: Yes django Basic settings of the framework , You can pair... For functions django Set up the database , Language, etc.__urls.py__:URL The configuration file , Quite a directory , Receive page requests , Jump to the target object , This object can be an application url.py, It may also be a view function
__asgi.py__ and __wsgi.py__: All are python Designed server gateway interface
Now let's try to run the project : Enter... Under task manager
python manage.py runserver
After successful operation, as shown in the figure
Let's copy the above
http://127.0.0.1:8000 And open it in the web page, as shown in the figure :
🥳 The successful running ! Congratulations on your success in building your own project ( This page is not configured URL route
when ,django Display your own page )
install django
Use windows+R Input cmd Open Task Manager
Use cd(change dictionary) Enter the directory where the project is stored
stay cmd Input in :django-admin startproject web
cd Enter the project directory , And enter :python manage.py runserver
stay cmd Copy... In the pop-up prompt url Address to web page open , The project was built successfully !
This is the use of cmd How to quickly build a project , You can also do it in pycharm To establish django But the configuration is relatively complicated , Interested students search for relevant information to find out .
Come here , If you have any questions about adding, deleting, modifying and checking
Welcome private bloggers to ask questions , Bloggers will do their best to answer your doubts !
🥳 If it helps you , Your praise is the greatest support for bloggers !!🥳