Automatic installation via a package manager
Several automatic package-installation tools are available for Python; the recommended one is pip.
Using pip, type:
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.
Begin by adding registration to the INSTALLED_APPS setting of your project, and specifying one additional setting:
- 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.
- 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:
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:
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.