---
slug: "Djangoで、簡易的なログインのURLを作る"
title: "Create a Simple Login URL with Django"
description: "\n\n\nurl(r'^login/', 'django.contrib.auth.views.login', name='login',\n    kwargs={'template_name': 'admin/login.html',\n            'extra_context': {'next': '/'}}),\n\nWrite this link in the template as follows,"
url: "https://www.ytyng.com/en/blog/Djangoで、簡易的なログインのURLを作る"
publish_date: "2015-05-29T11:31:02Z"
created: "2015-05-29T11:31:02Z"
updated: "2026-02-27T10:43:17.724Z"
categories: ["Django"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/fa2f94a4b8454d49b05351f27d7575be.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Create a Simple Login URL with Django

<div class="document">


<pre class="literal-block">url(r'^login/', 'django.contrib.auth.views.login', name='login',
    kwargs={'template_name': 'admin/login.html',
            'extra_context': {'next': '/'}}),
</pre>
<p>Write this link in the template as follows,</p>
<pre class="literal-block">&lt;a href="{% login %}"&gt;Login&lt;/a&gt;
</pre>
<p>and when clicked, the login page will appear.
After completing the login, you will be redirected to /.
</p>
<p>At the time of evaluation, if the URL of the top page is registered, I think it is possible to put the reversed URL in the next argument, but it seems difficult timing-wise, so we directly specify /.</p>
</div>
