MindMap Gallery Module package, html, django development framework notes
Module package, HTML, Django development framework notes, one picture will help you fully understand the relevant content, and help you improve efficiency through mind mapping, come and give it a try~
Edited at 2022-11-30 15:49:32This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
Module package, html, django development framework notes
Modules & Packages
module
definition
Define variables and functions of the same function into the same py file
mod.py
VAR
func
use
import
import mod
transfer
mod.VAR
mod.func()
File naming method
Meet Python variable naming conventions
Bag
definition
Put modules with the same function into the same folder
pkg
modA.py
VAR
func
modB.py
VAR
func
__init__.py
from .import mod
use
import
from pkg import modB
transfer
modB.func()
Basic introduction
HTTP
request
request header
request body
response
response header
response body
MVC
Model
Logical operations such as databases and files
models.py
View
Show data usage to users
You can directly use the data returned by the Controller
Call Model functions and variables
templates/*.html
Controller
Receive user request
Get user-submitted data
Call Model
Call View to render (data and template assembly) page and return
views.py
urls.py
Configure the relationship between the request url and the functions in views.py
html
Hypertext Markup Language
Tell the browser what to display
Format
<!DOCTYPE html> <html> <head> <!-- Information to the browser --> <meta charset="utf-8" /> <title>I am the first page</title> </head> <body> I am kk!! </body> </html>
Common tags
form
form
action
URL to submit data
method
Submission method
GET/POST
input
name
Specify the name of the data when submitting it
type
Tell the browser the type of input (display status)
text
password
button
submit
submit button
value
textarea
text field
name
sheet
table
thead
tr
th
tbody
tr
td
tfoot
tr
td
Hyperlink
a
href
django
web development framework
Third-party library management
pip
--version
search
install
pkg
pkg==vesrion
uninstall
develop
Create project
django-amdin startproject xxxx
Create app
python manage.py startapp xxx
Enable app in project
project/settings.py
INSTALLED_APPS
appName.apps.appNameConfig
Set access domain name or address
project/settings.py
ALLOWED_HOSTS
*
Specify url to distribute to app
Create app/urls.py
urlpatterns = []
url(regex, action, name=xxxx)
from django.conf.urls import url
url(r'index/', views.index, name='index')
project/urls.py
include
from django.conf.urls import include
urlpatterns = []
^appname/
url(r'^appname/', include('appname.urls', namespace='appname'))
Business logic
models
views
from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render def index(request): return HttpResponse('xxxx') return HttpResponseRedirect('xxxx') return render(request, tpl, context)
context = {'key' : value}
retrieve data
request.GET
request.POST
templates
show
{{ item }}
{{ item.index }}
{{ item.key }}
cycle
{% for item in items %} {% endfor %}
Conditional judgment
{% if item %} {% endif %}
urls