在GAE上为Django-nonrel订购中间件类

时间:2012-02-05 14:31:07

标签: django google-app-engine django-nonrel

任何人都可以澄清如何在中间件类下面订购吗?

'mediagenerator.middleware.MediaMiddleware', 
'autoload.middleware.AutoloadMiddleware', 
'django.middleware.cache.UpdateCacheMiddleware', 
    . 
    . 
    . 
'django.middleware.cache.FetchFromCacheMiddleware',
'google.appengine.ext.appstats.recording.AppStatsDjangoMiddleware', 

在文档中,顶级组中的每个中间件都被告知先来, 并且底部组中的两个中间件被告知最后。 这令人困惑。 下面是我正在使用的整个中间件列表:

'mediagenerator.middleware.MediaMiddleware', 
'autoload.middleware.AutoloadMiddleware', 
'django.middleware.cache.UpdateCacheMiddleware', 
'django.middleware.common.CommonMiddleware', 
'django.contrib.sessions.middleware.SessionMiddleware', 
'django.contrib.auth.middleware.AuthenticationMiddleware', 
'django.contrib.csrf.middleware.CsrfViewMiddleware', 
'django.middleware.csrf.CsrfResponseMiddleware', 
'django.middleware.cache.FetchFromCacheMiddleware', 
'google.appengine.ext.appstats.recording.AppStatsDjangoMiddleware',

任何帮助和解释都将不胜感激。

1 个答案:

答案 0 :(得分:0)

请检查一切是否正常:

'autoload.middleware.AutoloadMiddleware',   # This is loading other modules, so it goes first because we want everything set before processing.
'mediagenerator.middleware.MediaMiddleware',   # Serves/caches static files with urls starting with DEV_MEDIA_URL 
'django.middleware.cache.UpdateCacheMiddleware',   # Must be before other middleware that changes the header, so it seems that the right place for this is here
'google.appengine.ext.appstats.recording.AppStatsDjangoMiddleware', # Must be 'first' too. It collects stats of all middlewares below this. If you want stats from the middlewares above move it to the top

'django.middleware.common.CommonMiddleware', 
'django.contrib.sessions.middleware.SessionMiddleware', 
'django.contrib.auth.middleware.AuthenticationMiddleware', 
'django.contrib.csrf.middleware.CsrfViewMiddleware', 
'django.middleware.csrf.CsrfResponseMiddleware', 
'django.middleware.cache.FetchFromCacheMiddleware',