# LoginView does not seem to work

**URL:** <https://forum.djangoproject.com/t/loginview-does-not-seem-to-work/12981>\
**Category:** Mystery Errors\
**Created:** [April 3, 2022, 8:24pm UTC](https://forum.djangoproject.com/t/loginview-does-not-seem-to-work/12981 "2022-04-03T20:24:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![webdeveloper](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/webdeveloper/32/8019_2.png) [@webdeveloper](https://forum.djangoproject.com/u/webdeveloper)\
**Post date:** [April 3, 2022, 8:24pm UTC](https://forum.djangoproject.com/t/loginview-does-not-seem-to-work/12981/1 "2022-04-03T20:24:56Z")

</div>

Hi guys, I am following the example from Django for Beginner by William S. Vincent.

I am trying to add a log in page using the built-in LoginView.

I have the added a urlpattern to config/urls.py:

```auto
from django.contrib import admin

from django.urls import path, include

urlpatterns = [

    path('admin/', admin.site.urls),

    path('', include('blog.urls')),

    path('accounts/', include('django.contrib.auth.urls')),

]

```

I have created a new template file, templates/registration/login.html as follows:

```auto
{% extends 'base.html' %}

{% block content %}

    <h2>Log In</h2>

    <form method="'post">

        {% csrf_token %}

        {{ form.as_p }}

        <button type="submit">Log In</button>

    </form>

{% endblock content %}

```

And finally I added` LOGIN_REDIRECT_URL = 'home'` to config/settings.py.

I logged out via the localhost:8000/admin page. Then I navigated to localhost:8000/accounts/login and enter the user and password.

I see this in the terminal: [03/Apr/2022 16:20:59] “GET /accounts/login/?csrfmiddlewaretoken=LdjbrxGnie8ZQpCkyvYpd97FATAxGSFrRb24oKAcjzYeUfR0Cxf9A6RIdcCL7NBZ&username=admin&password=password HTTP/1.1” 200 1253

I didn’t not see an error or password error. I am not logged in and I did not get redirected to the home page. The version of Django I am using is 3.1.0. Can you please help and see if I am missing something?

Thank you very much for your help in advance!

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 4, 2022, 3:14am UTC](https://forum.djangoproject.com/t/loginview-does-not-seem-to-work/12981/2 "2022-04-04T03:14:20Z")

</div>

You’ve got an extra apostrophe in your form tag:

> [@webdeveloper](#):
>
> ```auto
> <form method="'post">
> 
> ```

Should be ` <form method="post">`

---

<div class="post-metadata">

**Author:** ![webdeveloper](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/webdeveloper/32/8019_2.png) [@webdeveloper](https://forum.djangoproject.com/u/webdeveloper)\
**Post date:** [April 4, 2022, 4:30am UTC](https://forum.djangoproject.com/t/loginview-does-not-seem-to-work/12981/3 "2022-04-04T04:30:44Z")

</div>

@KenWhitesell, thank you!

That solved the problem!
