5. Tieing it all together¶
Now we’ll tie it all together by setting the appropriate settings in our settings.py.
As we mentioned in the Installation you’ll need to add
newauth
to your INSTALLED_APPS:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
#...
'newauth',
#...
)
and add the AuthMiddleware
to your MIDDLEWARE_CLASSES
MIDDLEWARE_CLASSES = (
#...
'newauth.middleware.AuthMiddleware',
#...
)
Here we will set up the NEWAUTH_BACKENDS
so that we can authenticate and use our MyUser class that we set up earlier.
NEWAUTH_BACKENDS = {
'default': {
'backend': (
'newauth.backend.BasicUserBackend',
),
'user': 'account.models.MyUser',
'anon_user': 'account.models.MyAnonymousUser',
}
}
And that’s it! You should have a simple working example of how to use newauth. newauth allows a lot of customization so you can continue on and read some of the more advanced documentation or play some more with the example.
Good Luck!