The view [view name] didn’t return an HttpResponse object. It returned None instead.

다음과 같은 에러가 발생했다.

ValueError at /accounts/register/

The view accounts.views.register_view.register didn't return an HttpResponse object. It returned None instead.

Request Method: 	GET
Request URL: 	http://127.0.0.1:8000/accounts/register/
Django Version: 	4.0.3
Exception Type: 	ValueError
Exception Value: 	

The view accounts.views.register_view.register didn't return an HttpResponse object. It returned None instead.

Exception Location: 	/home/triplek/PycharmProjects/kwacc/venv/lib/python3.9/site-packages/django/core/handlers/base.py, line 332, in check_response
Python Executable: 	/home/triplek/PycharmProjects/kwacc/venv/bin/python
Python Version: 	3.9.5
Python Path: 	

['/home/triplek/PycharmProjects/kwacc',
 '/home/triplek/PycharmProjects/kwacc',
 '/usr/local/lib/python39.zip',
 '/usr/local/lib/python3.9',
 '/usr/local/lib/python3.9/lib-dynload',
 '/home/triplek/PycharmProjects/kwacc/venv/lib/python3.9/site-packages']

Server time: 	Mon, 18 Apr 2022 10:16:17 +0900

초보 티 내는 것도 아니고… ㅠㅠ

해결 방법은 아주 간다했다.

view에서 return을 하지 않았기 때문이다.

render(request, 'login.html')         # 기존 코드
return render(request, 'login.html')  # 수정 코드