Since keeping multiple authentication databases in sync is a common problem
when dealing with Apache, you can configure Apache to authenticate against
Django’s authentication system directly. This
requires Apache version >= 2.2 and mod_wsgi >= 2.0. For example, you could:
Distribuire files static/media direttamente da Apache solo ad utenti autenticati.
Autenticare l’accesso un repository Subversion per gli utenti Django con un certo permesso.
Permettere ad alcuni utenti di connettersi ad una condivisione WebDAV creata con mod_dav.
La direttiva WSGIAuthUserScript dice a mod_wsgi di eseguire la funzione check_password nello script wsgi specificato, passando il nome utente e la password che riceve dal prompt. In questo esempio, WSGIAuthUserScript è lo stesso di WSGIScriptAlias che definisce la tua applicazione creata da django-admin startproject.
Infine, modifica il tuo script WSGI mysite.wsgi per legare l’autenticazione di Apache ai meccanismi di autenticaizione del tuo sito importando la funzione check_password:
To support the WSGIAuthGroupScript directive, the same WSGI script
mysite.wsgi must also import the groups_for_user function which
returns a list of groups the given user belongs to.