一个django实例一个数据库vs不同的django实例 [英] One django instance one database vs different django instances

查看:138
本文介绍了一个django实例一个数据库vs不同的django实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个可以存储和管理医生资料的软件。我想问一些我想要部署我的项目的东西。起初我想为每个客户端提供不同的django实例。每个小组将拥有自己的数据库,并从其他数据库运行seperatelly。但是我不知道我可以自动执行这个过程,因为每个实例我需要有不同的数据库,不同的密码不同的db用户名,我不知道的东西它可以在创建我的django项目的每个新实例时自动化。还是在某种程度上想象下面的情况

 用户支付 - >成功付款后 - >创建DB(MySQL) - > 
django实例被创建 - >
不知何故django设置文件使用db凭据更新 - > syncdb运行

,此过程必须自动化。最好用一个数据库和分离来完成模型(使用外键等)吗?还是一个统一的数据库不是一个很好的解决方案(安全方面)?你怎么看?

解决方案

也许你可以看看多租户数据架构。



https://github.com/bernardopires/django-tenant-schemas



http://msdn.microsoft.com/en-us/library/aa479086.aspx


I am building a software that will store and manage doctor's data. I would like to ask something that came to me and has to do with how I want to deploy my project. At first I wanted to have different django instance for each client. Each clinet would have his own database and run seperatelly from the others. But I am not sure I can automate this procedure, because for each instance I need to have different database, different password different db username, something that I am not sure It can be automated while creating a every new instance of my django project. Or is it in some way. Imagine the following scenario

User pays -> After successfull payment -> DB(MySQL) is created -> 
django instance is created -> 
somehow django settings file is updated with db credentials -> syncdb is run

and this procedure must be automated. Is it better to have one db with and the seperation to be done from models (with foreignkeys etc)? Or is one unified database not a good solution (security side)? What do you think?

解决方案

maybe you can have a look on multi-tenant data architecture.

https://github.com/bernardopires/django-tenant-schemas

http://msdn.microsoft.com/en-us/library/aa479086.aspx

这篇关于一个django实例一个数据库vs不同的django实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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