Django 出现 frame because it set X-Frame-Options to deny 错误( 二 )

3 指定视图函数设置 X-Frame-Options
from django.http import HttpResponsefrom django.views.decorators.clickjacking import xframe_options_denyfrom django.views.decorators.clickjacking import xframe_options_sameorigin@xframe_options_denydef view_one(request):return HttpResponse("I won't display in any frame!")@xframe_options_sameorigindef view_two(request):return HttpResponse("Display in a frame if it's from the same origin as me.")

经验总结扩展阅读