One django instance one database vs different django instances

*爱你&永不变心* 提交于 2019-12-23 02:52:56

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/23366110/one-django-instance-one-database-vs-different-django-instances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!