Folders are mainly two MySite and My_registration plus a folder that holds a page template
(a) MySite in the settings.py and urls.py need to be changed
urls.py (R ' ^mysite/', include (' My_registration.urls ')) indicates that the URL to be accessed will be stripped mysite and then transmitted
Go to the My_registration folder to match the urls.py.
The settings.py to be modified are:
1. Add two global variable Account_activation_days=1 (activation code validity period),
Web_site= "http://localhost:8000/mysite/activate/" (activate URL)
2. To its databases also to be set
3.# e-mail settings
Default_from_email = ' Server mailbox full '
Email_host = ' SMTP server; for example: Smtp.126.com '
Email_host_user = ' Full Mailbox '
Email_host_password = ' Password '
4. Add the address of the page template in Template_dirs
5. Add ' my_registration ' in Installed_apps
(2) The My_registration folder need to modify the place is
1. Write a forms.py to register the regular Judgment of the page, the user name only judge, not null judgment and password two times input consistent judgment
2. Write a models.py, create a table in the database, the user table with Django from the table without generating,
So you just need to generate a table that holds the user ID and two fields of the activation code.
3. Write a urls.py, to respond to the requested Web page corresponding function
4. Write a views.py, write a register and activate function to process the registration and activation of Web pages.
(3) page template in the folder where the page template is stored
1.activate.html
2.registration_complete.html
3.registration_form.html
(4) After the completion of the three major strides,
1. Enter the local working directory:
/home/sunbaigui/documents/dijango/svn_sbg_django_myregistration/sbg_django_myregistration/mysite
2. Start the Django server: Python manage.py runserver
3. Enter Test URL: http://localhost:8000/mysite/register/for testing
The above steps just I finish the experiment after the logical finishing (only suitable for my own review of the use).
If a friend also want to implement this function can give me a message, I would like to help.