[英]Use same inventory for multiple sites in django python
Hi is there a way that i can use a same * inventory * for multiple * sites * in django . 嗨是没有办法,我可以利用相同的 * * 库存 多 * 网站在Django *的方式。 I am using the cartridge in django with mezanine.I need to create a multisite project with single cartridge.
我在带有Mezanine的django中使用该墨盒。我需要使用一个墨盒创建一个多站点项目。
I think you can try to use multiple databases with router: 我认为您可以尝试在路由器上使用多个数据库 :
DATABASES = {
'default': {
...
},
'cartridge': {
'NAME': 'cartridge_data',
...
}
}
class CartridgeRouter(object):
def db_for_read(self, model, **hints):
if model._meta.app_label == 'cartridge':
return 'cartridge'
return 'default'
def db_for_write(self, model, **hints):
if model._meta.app_label == 'cartridge':
return 'cartridge'
return 'default'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.