![](/img/trans.png)
[英]Is it possible to use the Django Sites Framework with multiple Sites on the same instance?
[英]Use same inventory for multiple sites in django python
嗨是沒有辦法,我可以利用相同的 * * 庫存 多 * 網站在Django *的方式。 我在帶有Mezanine的django中使用該墨盒。我需要使用一個墨盒創建一個多站點項目。
我認為您可以嘗試在路由器上使用多個數據庫 :
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.