ValueError: The view webapp.views.xxxxxx didn't return an HttpResponse object. It returned None inst

错误类型: 

Internal Server Error: /report/add_work_history/
Traceback (most recent call last):
  File "D:\language\Python\Python36\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
    response = get_response(request)
  File "D:\language\Python\Python36\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response
    "returned None instead." % (callback.__module__, view_name)
ValueError: The view webapp.views.add_work_history didn't return an HttpResponse object. It returned None instead.
[ERROR][2019-06-27 16:30:03,262][log.py:228]Internal Server Error: /report/add_work_history/
Traceback (most recent call last):
  File "D:\language\Python\Python36\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
    response = get_response(request)
  File "D:\language\Python\Python36\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response
    "returned None instead." % (callback.__module__, view_name)
ValueError: The view webapp.views.add_work_history didn't return an HttpResponse object. It returned None instead.
[27/Jun/2019 16:30:03] "POST /report/add_work_history/ HTTP/1.1" 500 17766

解决方案(一)提示:

 忘记加上  return

def add_work_history(request):
    """
    添加工作经验
    :param request:
    :return:
    """
    return report.add_work_history(request)

 

教训:

一定要细心,每个流程都要按照固定的格式去走,因为编程思想是自由的,但是语法和格式是死的,死的,死的!!! 

解决方案(二)提示:

检查各方法是否忘记加 return 后面的方法名了?

ValueError: The view webapp.views.xxxxxx didn't return an HttpResponse object. It returned None inst_第1张图片

你可能感兴趣的:(Django2.x,python,valueError,return,django,get_response)