Flask framework context & hook function
context
There are two contexts in the flash project, one is the application context (web), the other is the request context (request), the request context request and the application context current_app is A global variable, and all requests are shared. Flask has A special mechanism to ensure that the data of each request is isolated, that ...
Added by Swede78 on Tue, 01 Feb 2022 12:32:16 +0200
Django learning record 14
Relational mapping
The relational mapping in the database can be one-to-one, one to many and many to many.
1, One on one
When two tables have a one-to-one relationship, define a foreign key inside any model class.
Create a one-to-one mapping:
class A(models.Model):
pass
class B(models.Model):
a=models.OneToOneField(A,on_delete=***)
Aft ...
Added by outpost on Mon, 31 Jan 2022 14:44:19 +0200
python tourism project
Display of small tourism projects
The project adopts Vant UI as the UI of the project. The rapid prototyping interface, Vant's official address:
https://vant-contrib.gitee.io/vant/#/zh-CN/home The front-end page is formed by Vue cli, and the back-end relies on Django and uses Api communication to complete it quickly
Front page display
Mai ...
Added by crazykid on Fri, 28 Jan 2022 20:12:31 +0200
Use of restful framework in python django
When Django is used for front-end and back-end separation development, it is usually combined with Django rest framework to create RESTful interface API. For framework introduction and version requirements, please refer to the official address: https://www.django-rest-framework.org
This article takes creating an API containing name and sex f ...
Added by Abarak on Fri, 28 Jan 2022 15:54:57 +0200
Python learning notes -- 10 Django framework quick start background management admin (book management system)
1, Introduction to Django framework
Refer to official documents: Django official documents https://docs.djangoproject.com/zh-hans/3.2/
2, Create the first Django project
Create a new project - > select Django Django will be installed automatically If the network speed is too slow, you need to modify the pip source Modify pip sour ...
Added by vcv on Fri, 28 Jan 2022 03:12:38 +0200
jinja2 template and CSRF of Django template
2, Django uses the jinja2 template
2.1 jinja2 introduction
Jinja2: it is the next widely used template engine in Python. It is a template language implemented by python. Its design idea comes from Django's template engine and extends its syntax and a series of powerful functions, especially the built-in template language in Flask framework ...
Added by thinkaboutit on Sat, 22 Jan 2022 21:29:27 +0200
Django framework | personal blog website small project
1, Create project
The project is based on GitHub Hosting websites for source code
1. Create a remote repository of source code: blog
2. Clone remote warehouse
Note: git needs to be installed. Enter "git" on the windows terminal to test the environment
Note: you need to install the virtual environment (pyt ...
Added by rudy.siregar on Fri, 21 Jan 2022 18:13:59 +0200
Dashboard – horizon installation (wallaby version allinone)
Dashboard – horizon installation
This section describes how to install and configure a dashboard on a controller node.
The only core service required for dashboards is identity services. You can use dashboards with other services, such as image services, computing, and networking. You can also use dashboards in environments with stand-a ...
Added by ToddAtWSU on Thu, 20 Jan 2022 03:05:26 +0200
Order of Mido Mall (submit order 2)
2.4 use optimistic lock to place orders concurrently
Important:
When multiple users initiate an order request for the same commodity at the same time, first query the commodity inventory and then modify the commodity inventory, there will be resource competition, resulting in abnormal final results of inventory.
2.4.1. Concurrent order probl ...
Added by uwannadonkey on Tue, 18 Jan 2022 17:27:29 +0200
Django brief development process
1. New Django project
At the end of the Location is the Django project name, and select the virtual environment
In More Setting, you can select the template language and enter the APP name in Application name. If you do not enter the APP name, the new project does not contain APP by default. After the project is completed, you can use the co ...
Added by dsartain on Fri, 14 Jan 2022 20:18:06 +0200