A
A
Alexander2018-09-24 18:45:30
Django
Alexander, 2018-09-24 18:45:30

Why does the redirect work to the wrong page?

weber.html opens not on this page 127.0.0.1:8000/weber, but on this 127.0.0.1:8000/weber/weber/. Why is that?
main urls:

from django.contrib import admin
from django.urls import path
from django.conf.urls import include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('weber/', include('weber.urls'))
]

weber urls:
from django.urls import path
from weber import views

urlpatterns = [
    path('weber/', views.weber, name = 'weber')
]

views:
from django.shortcuts import render


def weber(request):
    return render(request, 'weber/weber.html', locals())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Malyarov, 2018-09-24
@AleksandrB

weber urls

from django.urls import path
from weber import views

urlpatterns = [
    path('' , views.weber, name = 'weber')
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question