Below is my urls.py in mysite/mysite/settings.py
urlpatterns = [
path('', TemplateView.as_view(template_name='homepage/main.html')),
path('admin/', admin.site.urls), # add something
path('polls/', include('polls.urls')),
path('hello/', include('hello.urls')),
path('accounts/', include('django.contrib.auth.urls')), # Add, Search how does djnago find template.
path('autos/', include('autos.urls')),
]
If some user request www.mysite.com/accounts/login
This request go to 'django.contrib.auth.urls' in there request go to path('login/', views.LoginView.as_view(), name='login') not in django/contrib/auth/urls.py..
But my login template is in mysite/homepage/templates/registration/login.html
And below is my login.html
{% extends "base_bootstrap.html" %}
{% block content %}
{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" class="btn btn-primary" value="Login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
{% endblock %}
It works well. so I don't know how Django find my login.html
How does Django find my login.html?