[BangPypers] Can two django projects be made to communicate to each other

Anubha Dadhich sethi.anubha at gmail.com
Wed Dec 1 13:06:09 CET 2010

On Wed, Dec 1, 2010 at 5:16 PM, Lakshman Prasad <scorpion032 at gmail.com>wrote:

> If I understand what you are saying,
> You have 2 different projects in django, (in different repos) and you don't
> want to have user logged in, in each site.

They are in the same repository. Yes we do not want user to log in at both
the places.

> The *simplest* way to solve this is to configure the django.contrib.auth of
> both the projects to use the same database. - And yes, it is a goddamn
> database. Any number of separate projects can open connections to it.

Yes the two projects are sharing the same database.

> Details about using multiple databases in projects can be found in the
> documentation:
> http://docs.djangoproject.com/en/dev/topics/db/multi-db/#defining-your-databases
> <
> http://docs.djangoproject.com/en/dev/topics/db/multi-db/#defining-your-databases
> >Essentially
> you will need to define the routers and for this case, the router is just a
> lambda that gives the user database if the app is django.contrib.auth.
The problem is that I do not understand how to make apache redirect requests
to their respective projects.

Say the projects, project1 and project2, have their respective urls.py file.

When the url is www.test.com/account/login --  the request should be
redirected to project1, because only the urls file in the project1 knows how
to resolve it.

as the url changes to www.test.com/profile -- the request should be
redirected to project2. (say profile requires user to be authenticated, then
as you and siddharta mentioned that user authentication is taken care by
django.contrib.auth backend and the two projects are already sharing the
same database, there should not be any problem in passing the user_context
between the two projects).

I need some links which will help me configure apache in the desired way.
That will help a great deal.

Thanks all.

More information about the BangPypers mailing list