Python
Getting Started with Pytest
· ☕ 2 min read
The Pytest framework is simple to use, rich in plugins, and powerful, and it is widely used for Python automated testing. This article introduces some basic concepts and usage of Pytest. 1. How It Runs Step one, Pytest reads its configuration from the command line or a file. Step two,

API of Serializer and ViewSet in restframework
· ☕ 4 min read
1. Serializer 1.1 Data Validation When deserializing data, the validity of the data needs to be checked. At this point you can call is_valid() for validation, and if a validation error occurs, you can get the error message from the .errors attribute. For example: 1 2 3 4 serializer.is_valid() # False serializer.

ViewSet and Serializer in restframework
· ☕ 6 min read
1. View Class in Django First, recall how Django handles a request. After receiving a request, Django creates a handler of type WSGIHandler, and the handler controls the entire processing flow. So how are the request URL and the View associated with each other? Django first loads the URLconf according to the ROOT_URLCONF setting, then matches the URLpatterns in the URLconf one by one in order, stopping as soon as a match is found.

Django Full-Stack Optimization Guide
· ☕ 9 min read
As the data volume exploded, the system responded very slowly. We carried out a series of optimizations on the application, and the system’s response time improved by an order of magnitude. Overall, optimizations in file compression and faster network access gave a noticeable boost to frontend performance, while optimizations in stored procedures, caching, and logic code gave a noticeable boost to backend performance.

Troubleshooting and Resolving Celery Failures on Large Files
· ☕ 3 min read
1. A Small Requirement We run into small requirements all the time, but they are not always simple to implement. Here is a simple file upload requirement, broken into the following steps: The user uploads a large file on the page The large file is temporarily stored in the internal