开发者

How to host a multi-tenant software on Django?

Imagine you have a main django project which hosts software for different tenants ->

The software would be hosted on -> www.tenantdomain.com

The main project is hosted on -> www.ourdomain.com

Supppose the software is accessed at this url -> www.ourdomain.com/tenant_id/home/

This should translate to -> www.tenantdomain.com/home/

How can one do that ?

One more thing, www.tenantdomain.com and www.ourdo开发者_如何学编程main.com our both hosted on one server and both of them access one database.


The Django way for this gives you two choices.

The fast way would be to host the various tenant's applications all on the same project with the Django sites framework. This is useful if the applications are sharing data. If this is not the case, you should clarify what you mean by your applications accessing one database. "One database" in Django means one project. Doing this basically means having URL proxying from tenant.com/{whatever} to yourapp.com/tenant/5/{whatever}.

The more complicated way would be total separation of of your tenant's applications to separate Django project instances. This means manually (or programatically) deploying each instance. This option requires more sys-admin tasks to happen in the background, but allows you maximum flexibility. More importantly, each application is completely separated from the others, so this is best in terms of security.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜