在两台服务器上有效地在两个Django应用程序之间进行通信(多租户)
I'm hoping to be pointed in the right direction as far as what tools to use while in the process of developing an application that runs on two servers per client.
[Main Server][Client db Server]
Each client has their own server which has a django application managing their respective data, in addition to serving as a simple front end.
The main application server has a more feature-rich front end, using the same models/db schemas. It should have full read/write access to the client's database server.
The final desired effect would be a typical SaaS type deal:
client1.djangoapp.com => Connects to mysql database @ client1_IP
client2.djangoapp.com => Connects to mysql database @ client2_IP
...
Thanks in advance!
我希望能够指出正确的方向,在开发每个客户端在两台服务器上运行的应用程序的过程中使用哪些工具。 [主服务器] [客户端数据库服务器]每个客户端都有自己的服务器,除了用作简单的前端之外,还有一个管理各自数据的django应用程序。主应用程序服务器具有功能更丰富的前端,使用相同的模型/ db模式。它应该具有对客户端数据库服务器的完全读/写访问权限。最终的预期效果将是典型的SaaS类型交易:client1.djangoapp.com =>连接到mysql数据库@ client1_IP client2.djangoapp.com =>连接到mysql数据库@ client2_IP ...提前致谢!
1 个解决方案
#1
1
You could use different settings files, let's say settings_client_1.py and settings_client_2.py, import common settings from a common settings.py file to keep it DRY. Then add respective database settings.
您可以使用不同的设置文件,比如settings_client_1.py和settings_client_2.py,从常见的settings.py文件中导入常用设置以使其保持干燥状态。然后添加相应的数据库设置
Do the same with wsgi files, create one for each settings. Say, wsgi_c1.py and wsgi_c2.py
对wsgi文件执行相同操作,为每个设置创建一个。比方说,wsgi_c1.py和wsgi_c2.py
Then, in your web server direct the requests for client1.djangoapp.com to wsgi_c1.py and client2.djangoapp.com to wsgi_c2.py
然后,在您的Web服务器中将client1.djangoapp.com的请求指向wsgi_c1.py,将client2.djangoapp.com指向wsgi_c2.py
更多相关文章
- 用于Python项目的低内存和最快查询数据库
- 如何让django芹菜写入测试数据库进行功能测试?
- 如何在Python中实现GCM HTTP服务器,同时避免我的服务器的IP被Goog
- 在生产中是否应该减少服务器代码?
- 28.mysql数据库之查询
- 运用Python语言编写获取Linux基本系统信息(三):Python与数据库编
- 独立于数据库的MAX()函数在SQLAlchemy中
- python--数据库支持
- Django 基础(一),项目创建、URL路由、数据库操作、模版