Question: I need split my current Django application into two sites. 

Site A will contain the public facing site which would contain all the static pages and the registration system. 

The other site — Site B — is the site for registered users. They can also log-in to application site through Site B.

If I'm not mistaken, I can use `django.contrib.sites` framework to accomplish the task of having multiple sites but can have a common authetication/registration backend?

How can I accomplish this?

Thanks.

Answer: 
Django's `django.contrib.sites` framework is nice if both sites are running under the same server and access the same database. If you have a distributed application (different sites on different hosts or different sites on different databases), you can resort to single sign-on solutions.

I use OpenID with a custom provider to centralize logins between apps running on different databases. Other solutions include [CAS](http://en.wikipedia.org/wiki/Central_Authentication_Service) ([provider](https://github.com/Nitron/django-cas-provider) and [consumer](https://github.com/Nitron/django-cas-consumer)).
For this case, you would have 2 settings.py files called settings\_A.py and settings\_B.py which specify `from settings import *`

A would have SITE=1 and B would have SITE=B. you can then set these files in your apache configs by setting the environment variable for each virtual host DJANGO\_SETTINGS\_MODULE=settings\_A and DJANGO\_SETTINGS\_MODULE=settings\_B

Then you set up the contrib.sites app with your 2 domain names bound to the appropriate site ID, and your flatpages will be able to be bound to either or both sites.

Lastly, in settings\_A.py settings\_B.py you either specify seperate root urlconfs or you use the use settings.SITE in your urlconfs to enable and disable groups of urls for each site.

Hope this helps

EDIT: To clarify: as long as you use the same database and SECRET\_KEY between both sites, you can use the same user accounts between them too. If the sites are of the form example.com and private.example.com then setting SESSION\_COOKIE\_DOMAIN to .example.com will allow the session to carry over between both sites.