views:

418

answers:

2

Hi,

I was hoping to get some suggestions on some best approaches to develop a multi tenant Django project on Google AppEngine.

Some Thoughts to Consider.

  • I would assume using djnago.contrib.sites is a must.

  • I would like to use existing applications such as django-profiles and django-registration, I know their models would need porting.

  • Can multiple domains be pointed to the GAE App and the site be automatically chosen from the request headers?

  • IF not multiple domains, is there a way to say take a request say to www.example.com/tenantA/login and www.example.com/tenantB/login and push them to one view but with knowledge tennant without changing all the views, maybe using custom managers to hide the complexity from the views.

Generally hoping this will be a discussion of any approaches you have taken in the past or plan to take.

Looking forward to any Comments/Answers.

Regards

Mark

+1  A: 

I can answer the App Engine questions for oyu, though I don't know the Django ones:

  1. Yes, anyone can point a domain to your app using Google Apps, with the 'add services' option, entering your App ID when prompted. You can then check the 'Host' header to determine what site you want to use.
  2. You can hide information per-tenant by using hooks to automatically insert the host in entities and queries: http://code.google.com/appengine/articles/hooks.html
Nick Johnson
Thanks for that, I didn't know about the hooks. Do you know if there are any considerations with the hooks and django working together?
Mark Ellul
There shouldn't be - the hooks operate at the lowest possible level of the SDK, so as long as Django is calling the APIs, the hooks get called.
Nick Johnson
A: 

Today Google release SDK 1.3.6 which includes Multi tenancy Baked right into the solution.

http://googleappengine.blogspot.com/2010/08/multi-tenancy-support-high-performance_17.html

Mark Ellul