Is AUTHENTICATION_BACKENDS a default setting found in settings.py in Django 3?

Viewed 3203

Following a book on django, at the point where it is discussing building a custom authentication backend. It states "The AUTHENTICATION_BACKENDS settings includes the list of authentication backends for your project. By default, this setting is set as follows: ['django.conrib.auth.backends.ModelBackend']" but nowhere in my settings.py do I see AUTHENTICATION_BACKENDS = ['django.conrib.auth.backends.ModelBackend']. This book uses Django 2. So I figured something may have changed, but the Django 3 documentation also states "By default, AUTHENTICATION_BACKENDS is set to:

['django.contrib.auth.backends.ModelBackend']"

Should I be looking somewhere else for this setting? I thought all settings were found in settings.py

2 Answers

Django has it's default settings if you don't specify one

A Django settings file doesn’t have to define any settings if it doesn’t need to. Each setting has a sensible default value. These defaults live in the module django/conf/global_settings.py.

add to your settings

AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', )

this will help to auth users from db, if you don't trust to default settings. IF YOU add more auth backends then this default also has to be included to them, as the default value will be overriden.

Related