我正在尝试使用带有Django 1.3的条件装饰器来设置etag标头。
我使用以下内容:
@condition(etag_func=profile_etag, last_modified_func=profile_last_modified)
@require_person_viewed_is_verified
def profile(request, id):
"""
Return profile for person id.
If profile is not verified only staff and self can view.
"""
user = request.user
...
中间件类
MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'johnny.middleware.LocalStoreClearMiddleware',
'johnny.middleware.QueryCacheMiddleware',
# 'django.middleware.cache.CacheMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'pybb.middleware.PybbMiddleware',
)
USE_ETAGS = True
我没有在http响应中设置etag或上次修改的标头。有什么想法吗?
答案 0 :(得分:0)
我使用的是CharlesProxy(这是一个很棒的工具)我没有启用缓存!学校男孩错误我知道!