我具有其中配置的移動部settings.py下面移動交換在Django中不起作用?
MIDDLEWARE_CLASSES = (
'site_middleware.SetSiteFromHost',
)
SITE_ID = 1
和site_middleware.py給出Django項目:
class SetSiteFromHost:
def process_request(self, request):
if mobileBrowser(request):
if request.GET.get('server', False):
request.session['server_mode'] = True
site = 1
elif request.session.get('server_mode') == True:
site = 1
else:
request.session['server_mode'] = False
site = 2
else:
site = 1
settings.SITE_ID = site
錯誤沒有顯示,但開關不工作?
什麼是*在這裏配置*輸入代碼? – iMom0