django 報錯 if resp.get('X-Frame-Options') is None:AttributeError: 'str' object has no attribute 'get'


報錯日志

Internal Server Error: /user/send_message
Traceback (most recent call last):
  File "D:\Anaconda\envs\django\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
    response = get_response(request)
  File "D:\Anaconda\envs\django\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "D:\Anaconda\envs\django\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "D:\Anaconda\envs\django\lib\site-packages\django\views\decorators\clickjacking.py", line 34, in wrapped_view
    if resp.get('X-Frame-Options') is None:
AttributeError: 'str' object has no attribute 'get'

解決方案:

      # 使用 HttpResponse
    return HttpResponse(1)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM