Category Python

Python basic tutorial. Python is an interpreted, object-oriented, high-level programming language with dynamic data types. Python was invented by Guido van Rossum at the end of 1989, and the first public release was released in 1991. Like the Perl language, the Python source code also follows the GPL (GNU General Public License) agreement. It is officially announced that on January 1, 2020, the update of Python 2 will be discontinued

Django Middleware Explained

What is Django middleware Middleware is a framework-level hook for handling requests (Requests) and responses (Responses) in Django, a lightweight, low-level plugin system for changing Django’s input and output globally. When a user performs an action in a website, the…

Introduction to Django templates

Preface There are a lot of templating systems on the market today, and the best known and used are DTL and Jinja2. DTL is an abbreviation of the three words Django Template Language, which is the template language that comes…

Django HttpResponse and JsonResponse

1. HttpResponse After the Django server receives the request sent by the client, it will encapsulate the submitted data into an HttpRequest object and pass it to the view function. Then the view function also needs to return a response…

Django time zone issues

We all know the time zone, the standard time zone is UTC time zone, Django uses UTC time zone by default, so the time we store in the database is UTC time, but when we make a website only for…

Django reverse function

The reverse function is used to reverse the URL, and then we introduce several uses of the reverse function. 1.Before, we used the URL to access the view function. Sometimes we know this view function, but want to reverse its…

Django foreign key and table relationship

Foreign key delete operation If a model uses foreign keys. What kind of operation should be performed after the other party’s model is deleted? Can be specified by on_delete. The types that can be specified are as follows. CASCADE: Cascade…

Python JWT introduction and use

JWT introduction ​ jwt (JSON Web Tokens) is a developed industry standard RFC 7519, which is used to securely express the statement between the two parties. At present, jwt is widely used in the user authentication of the system, especially…