찾다

 >  Q&A  >  본문

python - 使用django 的@etag(etag_entry),etag都返回的固定的,每次都一样,为啥总是返回200,不返回304?

1.使用django 的@etag(etag_entry),etag都返回的固定的,每次都一样,为啥总是返回200,不返回304?@last_modified(latest_entry)是可以返回304的。

代码如下:

def latest_entry(request):

return django_condition.objects.all().latest("published").published

def etag_entry(request):

return 'zk_test_etag'

#@condition(last_modified_func=latest_entry)

@etag(etag_entry)
def etagtest(request):

print request.META
return HttpResponse('last_modified_etag_testing')

巴扎黑巴扎黑2888일 전453

모든 응답(1)나는 대답할 것이다

  • 怪我咯

    怪我咯2017-04-17 17:45:24

    etag_entry의 반환 값을 return django_condition.objects.all().latest("published").published로 변경해 보면 어떻게 될까요?

    회신하다
    0
  • 취소회신하다