Django 中的多租户 SAAS [英] Multi-tenant SAAS in Django

查看:35
本文介绍了Django 中的多租户 SAAS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 PHP/Laravel 中开发了多租户 SAAS 应用程序,但最近我在 Django/Python 中开发了一个挑战.不过,我仍在学习 Django,而且我真的很喜欢 Django rest 框架 (DRF).但是我很难弄清楚下面突出显示的区域,如果有人显示出一些亮光,我会很高兴:

I have developed Multi-tenant SAAS apps in PHP/Laravel but recently I had a challenge to develop one in Django/Python. I am still learning Django though and I really like Django rest framework (DRF). But I have difficulties to figure out the highlighted areas below, If someone shows some light, I will be good to go:

  1. 如何处理子域/域并选择合适的租户数据库
  2. 如何在django中管理和动态处理不同的数据库
  3. 多租户应用后端是否仍可通过 Django 管理界面进行管理
  4. 我将使用队列和其他应用程序调用技术,需要提示和技巧(如果有)
  5. 任何例子
  6. 任何通过 Django 开发 SAAS 的挑战经验

推荐答案

嗯...

  1. django-subdomains
  2. 人们 在 SO 中询问了有关 django 中的动态数据库的问题(包括,咳咳...... ).我不完全确定我理解动态处理不同的数据库"的意思,所以我想只需转到我刚刚提到的链接并为您的项目选择最好的链接.(也可能 这更相关?)
  3. 查看 django-multitenant-schemas这个答案也是.
  4. 一段视频讲述了 Disqus(最大的 django 应用程序之一)背后的人在世界上)解释他们如何处理缩放.这里另一篇关于这个主题的有趣文章.此外,传说中的 SO 问题Django 是否可以扩展.
  5. (和 6.)查看这个答案
  1. django-subdomains
  2. There are people who asked in SO questions about dynamic databases in django (including, ahem... me). I'm not entirely sure I understood what you mean by "dynamically handle different database" so I guess just go to the links I just mentioned and pick out the best one for your project. (also - perhaps this is more relevant?)
  3. Check out django-multitenant-schemas and this answer too.
  4. There was a video of the guys behind Disqus (one of the largest django app in the world) explaining how they handle scaling. Here another interesting article on the subject. Also, the legendary SO question Does Django Scale.
  5. (and 6.) Check out this answer

我希望这足够详细.我知道这可能是一个令人失望的 only-links 答案,但这是它的现实 - Django 是一个较新的框架,并且使用 python 进行 Web 开发仍然不如 php 常见.考虑到这一点,请理解尽管 django 非常棒(而且它很棒),但对于更复杂的需求,您必须自己做更多的事情.

I hope that's detailed enough. I know this might be a disappointing only-links answer, but this is the reality of it - Django is a newer framework, and web development with python is still less common than php. With that in mind, understand that for all the awesomness of django (and it is awesome), with more complex needs there's more you'll have to do yourself.

在这种情况下,您必须弄清楚如何单独完成每一部分,然后将它们全部结合起来.例如,您可以轻松找到创建 REST django 应用程序的方法,但随后您需要弄清楚如何将其与另一个包(例如上述子域)组合.

In this case, you'll have to figure out how to do each part of the way seperatly and then combine it all. You can easily find a way to create a REST django app for example, but then you'll need to figure out how to combine it with another package (such as the above subdomains).

你可以找到一百万个人们用 Django 做怪事的例子.它真的很强大(当我了解动态模型时,我被震撼到了).但是您的应用程序越复杂,您就越需要自己动手.

You can find a million examples out there of people doing freaky things with django. It's really powerful (when I learned about dynamic models I was blown away). But the more complex your app, the more you'll need to do yourself.

拿起它,一次一个步骤,然后回到 SO,解决您遇到的具体问题(或 django 用户谷歌组).祝你好运!

Pick it up, one step at a time, and come back to SO with specific issues you're having (or the django users google group). Good luck!

这篇关于Django 中的多租户 SAAS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆