title: The view account.views.signup didn't return an HttpResponse object. It returned None instead
body: <p>Trying to register user in Django. it keep giving me HttpResponse error</p>
  <p>signup.html templates location is : templates/registration/signup.html</p>
  <p>Here's what i tried:</p>
  <h1>forms.py</h1>
  <pre><code>from django import forms
  from django.contrib.auth.forms import UserCreationForm
  from django.contrib.auth.models import User
  
  
  class SignUpForm(UserCreationForm):
      username = forms.CharField(max_length=50)
  
      class Meta:
          model = User
          fields = ('username', 'email', 'password1', 'password2', )
  </code></pre>
  <h1>views.py</h1>
  <pre><code>from django.contrib.auth import login, authenticate
  from django.shortcuts import render, redirect, HttpResponse
  
  
  from django.contrib.auth.decorators import login_required
  from .forms import SignUpForm
  
  
  @login_required
  def home(request):
      return render(request, 'registration/home.html')
  
  def signup(request):
      if request.method == 'POST':
          form = SignUpForm(request.POST)
          if form.is_valid():
              form.save()
              email = form.cleaned_data.get('email')
              raw_password = form.cleaned_data.get('password1')
              user = authenticate(email= email, password= raw_password)
              login(request, user)
              return redirect('registration/home')
          else:
              form = SignUpForm()
          return render(request, 'registration/signup.html', {'form': form})
  
  </code></pre>
  <p>I did tried replacing redirect with HttpResponseRedirect but it did't work</p>
  <h1>Account urls.py</h1>
  <pre><code>from django.contrib.auth import views as auth_views
  from django.conf.urls import url
  from django.urls import path 
  from . import views
  
  urlpatterns = [
      path(&quot;login/&quot;, auth_views.LoginView.as_view(template_name = &quot;registration/login.html&quot;), name='login'),
      path(&quot;logout/&quot;, auth_views.LogoutView.as_view(), name='logout'),
      path('home/', views.home, name='home'),
      url('signup/', views.signup, name='signup'),
  ]
  </code></pre>
  <h1>Error</h1>
  <pre><code>ValueError at /accounts/signup/
  The view account.views.signup didn't return an HttpResponse object. It returned None instead.
  Request Method: GET
  Request URL:    http://127.0.0.1:8000/accounts/signup/
  Django Version: 3.0.3
  Exception Type: ValueError
  Exception Value:    
  The view account.views.signup didn't return an HttpResponse object. It returned None instead.
  </code></pre>