Django Lgoin and Registration Process ( Python )

Installing django-registration-redux

Automatic installation via a package manager

Several automatic package-installation tools are available for Python; the recommended one is pip.
Using pip, type:
pip install django-registration-redux  
It is also possible that your operating system distributor provides a packaged version of django-registration-redux. Consult your operating system’s package list for details, but be aware that third-party distributions may be providing older versions of django-registration-redux, and so you should consult the documentation which comes with your operating system’s package.

Settings

Begin by adding registration to the INSTALLED_APPS setting of your project, and specifying one additional setting:
ACCOUNT_ACTIVATION_DAYS
This is the number of days users will have to activate their accounts after registering. If a user does not activate within that period, the account will remain permanently inactive and may be deleted by maintenance scripts provided in django-registration-redux.
REGISTRATION_AUTO_LOGIN
Optional. If this is True, your users will automatically log in when they click on the activation link in their email. Defaults to False.
For example, you might have something like the following in your Django settings file:
INSTALLED_APPS = (      'django.contrib.auth',      'django.contrib.sites',      'registration',      # ...other installed applications...  )    ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.  REGISTRATION_AUTO_LOGIN = True # Automatically log the user in.  
Once you’ve done this, run manage.py syncdb to install the model used by the default setup.

Setting up URLs

The default backend includes a Django URLconf which sets up URL patterns for the views in django-registration-redux, as well as several useful views in django.contrib.auth (e.g., login, logout, password change/reset). This URLconf can be found at registration.backends.default.urls, and so can simply be included in your project’s root URL configuration. For example, to place the URLs under the prefix /accounts/, you could add the following to your project’s root URLconf:
(r'^accounts/', include('registration.backends.default.urls')),  
Users would then be able to register by visiting the URL /accounts/register/, login (once activated) at /accounts/login/, etc.
Another URLConf is also provided – at registration.auth_urls – which just handles the Django auth views, should you want to put those at a different location.

About the author

Being the CEO and Founder of ClecoTech International, Mr. Ashish Prajapati is dedicated towards his aim of mentoring young startups into a full-fledged businesses. He is helping startups from America, Europe, India, and various other countries through proper guidance and the use of latest technologies to develop their innovation and ideas into definite realities.

Leave a Reply

Your email address will not be published. Required fields are marked *