title: Can't login on Heroku deployed app, but can login locally
body: <p>On my web-app, registering and signing in works great while am using the developing server <a href="http://127.0.0.1:8000/" rel="nofollow noreferrer">http://127.0.0.1:8000/</a>, But when I deployed the website on Heroku ,, it is not working well .. only users created using <code>createsuperuser</code> works .. </p>
  
  <p>Also, after registering the user signs in automatically after registering.</p>
  
  <p>But when they logout .. they can't login again </p>
  
  <p>here are my code :</p>
  
  <p><strong>signup view</strong></p>
  
  <pre><code>def signup(request):
      current_user_ip = get_client_ip(request)
      current_temp = Temp.objects.filter(created_by_ip=current_user_ip)
      current_temp.delete()
      if request.method == 'POST':
          signup_form = SignUpForm(request.POST, request.FILES)
          if signup_form.is_valid():
              signup_form.save()
              messages.info(request, "Thanks for registering. You are now logged in.")
              new_user = authenticate(username=signup_form.cleaned_data['email'],
                                      password=signup_form.cleaned_data['password1'],
                                      )
              login(request, new_user)
              return redirect('dashboard')
      else:
          signup_form = SignUpForm()
  
      context = {
          'signup_form': signup_form,
      }
      return render(request, 'signup.html', context)
  </code></pre>
  
  <p><strong>forms.py</strong></p>
  
  <pre><code>class EmailAuthForm(AuthenticationForm):
      def clean_username(self):
          return self.cleaned_data["username"].lower()
  
  
  class SignUpForm(UserCreationForm):
      email = forms.EmailField(required=True, help_text='Must be a valid E-mail')
      user_name = forms.CharField(required=True, help_text='')
      password1 = forms.CharField(widget=forms.PasswordInput,
                                  help_text='')
      password2 = forms.CharField(widget=forms.PasswordInput,
                                  help_text='Password confirmation')
      avatar = forms.ImageField()
  
      class Meta:
          model = User
          fields = ('email', 'user_name', 'password1', 'password2', 'avatar')
          labels = {
              'user_name': 'user_name',
              'email': ' email',
              'password1': 'password1',
              'password2': 'password2',
              'avatar': 'avatar',
          }
  
      def clean_email(self):
          data = self.cleaned_data['email']
          return data.lower()
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>path('login/', auth_views.LoginView.as_view(authentication_form=EmailAuthForm), name="login"),
  path('signup/', web_site_views.signup, name='signup'),
  </code></pre>