django-rest_framework - Request and response

Requests and responses Request object The REST framework introduces a Request object, which extends the ordinary HttpRequest and provides more flexible and clear parsing. The core function of the Request object is request.data Property, which corresponds to the request.POST Similar, but more useful ...

Posted by NFD on Sun, 14 Jun 2020 01:32:55 -0700

Django form form upload file

File upload of Django's form form When generating input tags, you can specify the type of input tag as file type <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <h4>{{ error_message }}</h4> <form action="/index/" method="pos ...

Posted by phpnewbieca on Thu, 11 Jun 2020 22:50:09 -0700

Daily fresh Django project

1. E-commerce mode B2B: Business to Business (Alibaba) C2C: customer to consumer B2C: Business to Customer C2B: Customer to Business individual to enterprise (commodity house matching) (individual demand, enterprise production) O2O: Online to Offline (meituan, hungry) F2C: Factory to Customer ...

Posted by sparshdharam on Thu, 11 Jun 2020 22:41:21 -0700

Django - Lifecycle of Requests & Templates & Routing

Lifecycle requested in Django 1. Overview First, we know that all data transferred in HTTP requests and server responses is strings. In Django, when we visit a url, we enter the corresponding html page through route matching. Django's request life cycle is what happens behind the scenes when a user enters a url into the browser and the user see ...

Posted by strangebeer on Tue, 09 Jun 2020 19:18:49 -0700

Day 59: Web Development Django model

by Aurora Today, I'd like to introduce the model part of Django framework. The model is a simple and clear description of real data. It contains the necessary fields and behaviors for stored data. Django follows the DRY Principle. Its goal is that you only need to define the data model, and then you don't need to care about other miscellaneous ...

Posted by gb75 on Sun, 31 May 2020 23:09:39 -0700

abandon os.path , embrace pathlib

Based on Python's file, directory and path operations, we usually use os.path modular. pathlib is its replacement in os.path On the basis of the encapsulation, the path is objectified, the api is more popular, the operation is more convenient, more in line with the thinking habits of programming. The pathlib module provides classes that use sem ...

Posted by SuNcO on Tue, 19 May 2020 20:44:08 -0700

Install single node Redis

Forward link http://www.python3.vip/tut/webdev/django/17/ Installing Redis on Linux It is recommended to compile and install the source code, so that you can freely choose the Redis version to install. For example, on centos 7, log in as root and execute the following commands to download, decompress, compile and install wget http://downl ...

Posted by Hepp on Sun, 17 May 2020 03:31:23 -0700

Behavior pattern: observer pattern

Behavior mode: Observer mode: Also known as: event subscriber, Listener, event subscriber, Listener, Observer intention The observer pattern is a behavioral design pattern that allows you to define a subscription mechanism, Multiple "watch" other objects of an object can be notified when an object event occurs. Core: the observed and ...

Posted by tolputt-craig on Thu, 14 May 2020 07:13:25 -0700

Django framework comprehensive explanation -- authentication system (auth)

Auth module is a standard permission management system provided by Django. It can provide user identity authentication, user group management, and can be used in combination with admin module. Add 'django.contrib.auth' in installed Apus to use the app, and the auth module is enabled by default model from django.contrib ...

Posted by rbastien on Sun, 10 May 2020 07:28:21 -0700

Section 4 of Django 2.0 introduction

Continued Django 2.0 introductory tutorial section 3 This section describes how to vote in the foreground. Build a simple form submission page polls/templates/polls/detail.html <h1>{{ question.question_text }}</h1> {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} <form action=" ...

Posted by mitzleah on Sat, 02 May 2020 16:49:41 -0700