I’ve got an email address based backend I’m trying to use.
I’ve put the code in:
myapp /
mymodule /
backends.py
and in settings.py I’ve got
AUTHENTICATION_BACKENDS = (
'myapp.mymodule.backends.EmailOrUsernameModelBackend',
'django.contrib.auth.backends.ModelBackend'
)
but I get the error
Module "myapp.mymodule.backends" does not define a
"EmailOrUsernameModelBackend" authentication backend
What am I doing wrong?
Your
settings.pyand project layout look ok. You’ve not shown us your backends.py, so all we can do is guess why it’s not working.It might be a typo in your
backends.pyor yoursettings. Check that the name of your backend class exactly matchesEmailOrUsernameModelBackend, including capital letters.If you’re not using the built in dev server, make sure that you’ve restarted it so that you’re not running an older version of the code.