Settings Variables
These are the variables that you can set from settings.py to change some features of the app.
DEFAULT_HTTP_PROTOCOL (=”http”): The default protocol used for when generating URLs, e.g. for the password forgotten procedure. Note that this is a default only – see the section on HTTPS for more information.
ACCOUNT_LOGIN_ON_SIGNIN (=True): Automatically log the user in once they register.
ACCOUNT_SIGNIN_REDIRECT_URL (=”/login”): The URL (or URL name) to redirect user in once they register if ACCOUNT_LOGIN_ON_SIGNIN if False.
ACCOUNT_LOGIN_REDIRECT_URL (=”/”): The URL (or URL name) to redirect to directly after login.
ACCOUNT_LOGOUT_REDIRECT_URL (=”/”): The URL (or URL name) to redirect to directly after logout.
EMAIL_VERIFICATION (=”optional”): Determines the e-mail verification method during signup – choose one of “mandatory”, “optional”, or “none”. When set to “mandatory” the user is blocked from logging in until the email address is verified. Choose “optional” or “none” to allow logins with an unverified e-mail address. In case of “optional”, the e-mail verification mail is still sent, whereas in case of “none” no e-mail verification mails are sent.
UNIQUE_EMAIL (=True): Enforce uniqueness of e-mail addresses. The emailaddress.email model field is set to UNIQUE. Forms prevent a user from registering with or adding an additional email address if that email address is in use by another account.
MAX_EMAIL_ADDRESSES (=None): The maximum amount of email addresses a user can associate to his account. It is safe to change this setting for an already running project – it will not negatively affect users that already exceed the allowed amount. Note that if you set the maximum to 1, users will not be able to change their email address as they are unable to add the new address, followed by removing the old address.
EMAIL_CONFIRMATION_EXPIRE_DAYS (=3): Determines the expiration date of email confirmation mails (# of days).
EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL (=”/login”): The URL to redirect to after a successful e-mail confirmation, in case of an authenticated user
EMAIL_CONFIRMATION_COOLDOWN (=180): The cooldown period (in seconds) after a confirmation email is sent, during which further emails are not sent.
LOGIN_ON_EMAIL_CONFIRMATION (=False): The default behaviour is not log users in and to redirect them to EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL
. By changing this setting to True, users will automatically be logged in once they confirm their email address. Note however that this only works when confirming the email address immediately after signing up, assuming users didn’t close their browser or used some sort of private browsing mode.
SOCIAL_ACCOUNT_PROVIDERS (=dict): Dictionary containing provider specific settings. The ‘APP’ section for each provider is generic to all providers and can also be specified in the database using a SocialApplication model instance instead of here.
Example:
SOCIAL_ACCOUNT_PROVIDERS = {
"google": {
"SCOPE": ["email", "profile"],
"AUTH_PARAMS": {
"access_type": "online",
"response_type": "code",
"prompt": "select_account",
},
"AUTHURL": "https://accounts.google.com/o/oauth2/v2/auth",
"ACCESS_TOKEN_URL": "https://accounts.google.com/o/oauth2/token",
"USER_INFO_URL": "https://www.googleapis.com/oauth2/v1/userinfo",
},
}