1. prepare the project and application, enable mysql, configure admin, configure settings, and create template 2. urls [python] from django. conf. urls. defaults import patterns, include, url from django. contrib import admin. autodiscover () urlpatterns = patterns ('', url (R' ^ admin/', include (admin. site. url (R' ^ login/$ ', 'blog. views. login'),) 3. views and forms [python] # coding: utf8 from django. shortcuts import render_to_response from django import forms f Rom django. http import HttpResponse class UserForm (forms. form): name = forms. charField (initial = 'aaa', label = 'name', min_length = 4, max_length = 16) # initial can provide mail = forms. emailField () sex = forms. choiceField (choices = ('M', 'male'), ('F', 'female ') marry = forms. booleanField (required = False) birth = forms. dateField (initial = '2017-12-24 ') intr = forms. charField (widget = forms. textarea () def login (r Eq): if req. method = 'post': # bind userForm = UserForm (req. POST) # class instantiation // bind. encapsulate req in form if userForm. is_valid (): name = req. POST. get ('name') # The first method is to obtain a string. mail = userForm is not recommended. cleaned_data ['mail'] # The second method is to obtain data = userForm in python format. cleaned_data.items () # method 3 return HttpResponse (data) else: userForm = UserForm (initial = {'mail': 'A @ B .com '}) # initial in parentheses can provide the initial value return render_to_response (' Login.html ', {'userform': userForm}) 4.html [html] <body> <form action = "" method = "post"> <! -- Enter action >{{ userForm. as_ul }}<! -- UserForm's as attribute, as_p, as_table --> <input type = "submit" value = "login"> </input> </form> </body> 5. syncdb, runserver