[Answered ]-Why is my web service trying to redirect to a URL that does not exist?

1👍

I’ve taken a look at your code.
That’s not the redirect problem.

That’s because of submit url of the login form.
You should change the code like below.

<form action = '/accounts/login' method = 'post'>
  {% csrf_token %}
  <input type="text" name="username" placeholder="Username"><br>
  <input type="password" name="password" placeholder="Password"><br>
  <input type = 'submit'>
</form>

In addition, When check the authentication, you should check user, not username.

if user is not None:
    auth.login(request, user)
    return redirect('/')
else:
    return redirect('/accounts/register/')
👤Adam

Leave a comment