Friday, September 9, 2011

Re: Multitenant in Django

you could write a middleware that looks at the request.META and
inserts the correct id into the request?

you won't be able to access it like you would with the
settings.SITE_ID, but it should be a start

On Sep 9, 5:02 am, sjtirtha <sjtir...@gmail.com> wrote:
> Hi,
>
> I'm looking for the best solution to have a multitenant in django.
> Site Framework is often mentioned support multitenant.
> But site framework is developed for websites which have several static sites.
>
> What I' looking for now is multitenant and not multi site.
> So I want to have the possibility, when a user register in my web app,
> he/she can choose a subdomain.
> For example: user A:http://a.mywebapp.com;user B:http://b.mywebapp.com.
> So the number of subdomain is not static, it increases by the number of user.
>
> Currently, with the site framework, I'm able to separate the data by
> adding SITE_ID as foreign key in all my model.
> So the data for each user/subdomain are separated by SITE_ID. It works
> very well.
> I even enhanced the user by user profile with SITE_ID and the
> authentication is also site specific. So a user can only login into
> his/her SITE and see only his/her data, not from others.
>
> The problem now is, since the SITE_ID is defined static in
> settings.py, for each user/subdomain I need a django instance with
> different SITE_ID. So if I have 20 user/subdomain, it means I need 20
> django instances.
>
> And I cannot (or it will be very complex) create automatically django
> instance for each new registered user.
>
> Can someone share his opinion or experience how to handle this?
>
> Regards,
> Steve

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment