Перенаправление гиперссылок не работает в Django
У меня есть приведенный ниже код как часть моего проекта. Но вместо перенаправления на HTML страницу (contact.html
), он перенаправляет обратно на главную страницу или index.html
.
main_app/urls.py
:
path("", home_views.index, name='home_page'),
path("contact", home_views.contact, name='contact'),
main_app/home_views.py
:
def index(request):
return render(request, 'Varsity/index.html')
def contact(request):
return render(request, 'Varsity/contact.html')
Varsity/index.html
:
<li><a href="{% url 'contact' %}">Contact</a></li>
Терминал
[05/Sep/2022 14:34:43] "GET /contact HTTP/1.1" 302 0