• Detailed explanation of the use of Django DRF pager


    preface When there is too much data returned from the background, we need to configure the pager. For example, a page can only display 10 items at most,drfThree sub pages are configured by default in Pagenumberpagination: basic pager with slightly poor performance Limitoffsetpagination: offset pager Cursorpagination: cursor pager with powerful performance PageNumberPagination Basic pagerPageNumberPagination, the […]

  • Use of F and Q queries in Django


    catalogue F query Q query affair Other little-known operations Django ORM executes native SQL Queryset method Encyclopedia F query In all the above examples, the filter we constructed only compares the field value with a constant set by ourselves. If we want to compare the values of two fields, what should we do? Django provides […]

  • How to use restful framework in Python Django


    Use of restful framework When Django is used for front-end and background separation development, it is usually matched withdjango-rest-frameworkThe framework creates restful style interface APIs. Refer to the official address for framework introduction and version requirements: https://www.django-rest-framework.org This article to createmancontainname、sexThe API of the field is instance learningdjango-rest-frameworkUse of framework. It mainly includes the following […]

  • Example of django+celery implementing scheduled tasks


    catalogue 1、 Foreword 2、 Configuration use Define and trigger tasks extend 3、 Using scheduled tasks in Django Secondary development 1、 Foreword Celery is a distributed task queue developed based on python, and Django is the most popular framework for Python web development. However, the request processing process of Django is synchronous, and asynchronous tasks cannot […]

  • Use of Django rest framework current limiting function


    catalogue Body start 1. current limiting in DRF 2. current limiting advanced configuration 3. analysis of current limiting ideas 4. source code analysis 5. other precautions reference material Body start Let’s start with the concept of current limiting, which was first introduced at the front end. The real business scenario is that when you enter […]

  • Teach you to use Django to store the front-end data into the MySQL database


    catalogue 1. models under app PY 2. data migration (use pychart’s own terminal tool) 3. views PY 4. front end 5. effect   1. models under app PY Specific codes are as follows: class Apply(models.Model): The clas and names under the apply class will become the list names in the MySQL database through data migration […]

  • Detailed explanation of Django template filter and inheritance example


    catalogue Template filter Inheritance of templates Template inheritance example summary Template filter Definition: process the value of a variable when it is output Function: you can change the output display of variables by using filters Syntax:{{variable | filter: ‘parameter value 1’ | filter 2:’parameter value 2’…}} Common filters filter explain lower Convert all strings to […]

  • Analysis of Django interface version control


    catalogue 1、 Foreword 2、 Disposition 2.1. Global configuration 2.2. View configuration 3、 Five version control classes built in DRF 3.1、AcceptHeaderVersioning 3.1.1. HTTP access method 3.1.2、settings 3.1.3、serializers 3.1.4、views 3.1.5 access 3.2、URLPathVersioning 3.2.1. HTTP access method 3.2.2、settings 3.2.3、urls 3.2.4 access 3.3、NamespaceVersioning 3.3.1. HTTP access method 3.3.2、settings 3.3.3、urls 3.3.4 access 1、 Foreword stayRESTfulIn the specification, for problems related […]

  • Major changes in Django version 4.0! Which version are you still using?


    Django 4.0 has been officially released in December 2021, marking Django 4.0 The advent of the X era. As loyal fans of Django, are you ready for exciting changes in the new version? Last year was very busy. Please forgive this late article. Python compatibility Django 4.0 will support Python 3.8, 3.9, and 3.10. Django […]

  • Iis10 deploy Django


    Environmental Science: Python3.10 Django4.0.3 IIS10 WindowsServer2019 IIS 1. Installation As shown in the figure below, check CGI and install it. Others can choose by themselves. This tutorial needs a certain IIS foundation Figure I 2. Assign the original code of the project, and Django does not need to compile Copy the project to the server […]

  • Django build blog three installation applications and page layout


    Initialize application Install system Select tools – > run manage Py task, the operation is shown in the figure below Execute the following command in the pop-up window Or open the terminal at the current project location and execute the following command python manage.py startapp system The system app will be generated in the \ […]