Accumulating URLs in DJANGO

1

My urls are piling up. When I pass via tag a[href="exemplo"] it sends to url http://localhost:8000/index/ , but if I click again on some other link on the same menu, it will redirect to http://localhost:8000/index/outrolocal adding the other url after the example. How could I get him to fetch the requested url without getting past urls

I know I could put the /index/ of the tag that will call, however, I'm extending a menu, I do not want to put it all the time.

url.py

from geral.views import index, login, recuperar
urlpatterns = [
       path('', index),
       path('index/', index),
       path('login/', login),
]

general / view.py

from django.shortcuts import render

# Create your views here.
def index(request):
    return render(request, 'index.html')
def login(request):
    return render(request, 'login.html')
def recuperar(request):
    return render(request, 'recuperar.html')

file.html

<a href="index">Inicio</a>
<a href="login">Login</a>
    
asked by anonymous 18.05.2018 / 17:05

1 answer

0

I do not know Django but you can try:

<a href="/index">Inicio</a>
<a href="/login">Login</a>

instead of

<a href="index">Inicio</a>
<a href="login">Login</a>
    
18.05.2018 / 21:16