Implementation of Registration Mailbox Verification and Login Verification Code
Django Sends Mail
Modules need to be used
from django.core.mail import send_mail,send_mass_mail
SMTP is a mail server, each kind of mailbox SMTP server address is different, Baidu itself
For example, mailbox 163 is smtp.163.com
1. Adding configuration to settings
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.Django ...
Posted by TheRealPenguin on Sat, 25 May 2019 13:13:15 -0700
Use Kind Editor Rich Text Editor in django admin or applications
Because there is no rich text editor in django background management, the pages displayed are ugly, and the WYG editing method cannot be achieved, we need to introduce a third-party rich text editor.
Previously, many documents have been found before the blog to make this function. Although some blogs write well, after all, they are not written ...
Posted by BETA on Wed, 22 May 2019 12:56:55 -0700
Django - Cross Domain Request (jsonp)
Homology Policy
If both pages have the same protocol, port (if specified) and domain name, then both pages have the same source.
Example: Two Django demo s
demo1
url.py
url(r'^demo1/',demo1),
view.py
def demo1(request):
return HttpResponse("demo1")
demo2
url.py
url(r'demo2$',demo2),
view.py
def demo2(request ...
Posted by Barkord on Sun, 19 May 2019 17:53:41 -0700
Django (novice bird course)
Learn the Django tutorial of the novice bird tutorial, link as follows:
http://www.runoob.com/django/django-tutorial.html
Installation:
pip install Django
If PIP < 1.4, use:
pip install https://www.djangoproject.com/download/1.11a1/tarball/
Or clone code:
git clone https://github.com/django/django.git
Create a project:
django-admin.py star ...
Posted by plisken on Fri, 17 May 2019 12:22:11 -0700
Python Background Development Django (Template and Value Matching)
Template files
In setup.py, set the template location
The Use of view in APP
from django.shortcuts import render #Import
def homex(requestx):
return render(requestx,"loginx.html") #Return file
Page template
Realize the reuse of page layout, establish the name inside the template and display the original data if ...
Posted by Skepsis on Fri, 17 May 2019 06:25:51 -0700
Five Usages and Logical Processes of Developing Advanced-Django Framework Middleware in Python 3
Reading catalogue
What is Middleware
Execution flow of Middleware
Logical Process of Middleware
1. What is middleware?
Officially, middleware is a framework-level hook for handling Django requests and responses. It is a lightweight, low-level plug-in system for changing Django input and output globally.
Each middleware component i ...
Posted by ubaldc36 on Fri, 17 May 2019 05:33:07 -0700
Django Summarizes Knowledge Points
### Caching and Query Sets
Each QuerySet contains a cache to reduce the actual operation on the database. Understanding this concept will help you improve query efficiency.
For the newly created QuerySet, its cache is empty. When the QuerySet is first submitted, the database performs the actual query operation. Django stores the results of the ...
Posted by stephenalistoun on Thu, 16 May 2019 15:05:03 -0700
Python_restframework (serialization)
serializers, a serialization tool that comes with django
Three Steps
Import from django.core import serializers
Generate object and pass response = serializers.serialize('json', book_list)
The first json is a parser that says you want to parse a string in json format.
The second is the queryset object.
Finally returns the result return ...
Posted by kdoggy on Wed, 15 May 2019 18:42:43 -0700
Python Full Stack Web (Django Framework, Background Management, ORM Relationships)
F query and Q query:
F()
Get the value of a field in its execution
F("field name")
Increase everyone's age by 10
form django.db.models import F
Author.objects.all().update(age=F("age")+10)
def doF_views(request):
Author.objects.all().update(age=F('age')+10)
return redirect('/07-queryall')
Q()
The or oper ...
Posted by anxiety on Wed, 15 May 2019 03:19:36 -0700
Automated Operations and Maintenance Platform (Backend Pthon + django)
Django's MTV Mode
Django's MTV mode is essentially the same as MVC's, but also for the sake of maintaining loosely coupled relationships among components. There are only slightly different definitions. The value of Django's MTV is:
M Representation Model: Responsible for relational mapping (ORM) between business objects and databases.
T sta ...
Posted by icyfire624 on Tue, 14 May 2019 05:16:08 -0700