I want to call another html file from another html file (Magamrol.html), but when I try to open it the following happens:
Using the URLconf defined in mysite.urls, Django tries these URL patterns in the following order:
[name='index'] admin/ polls/
The current path Magamrol.html does not match any of the above patterns.
My application is polls and the project name is mysite. mysite\polls\urls.py:
from django.urls import path from . import views from polls import views urlpatterns = [ path('', views.index, name="index"), path('', views.magamrol, name='Magamrol') ]
mysite\polls\views.py:
from django.http import HttpResponse from django.shortcuts import render def index(request): return HttpResponse("Üdvözöllek a honlapomon!") def index(request): return render(request, 'index.html') def magamrol(request): return render(request, 'Magamrol.html')
mysite\urls.py:
from django.contrib import admin from django.urls import include, path from polls import views urlpatterns = [ path('',views.index,name="index"), path('admin/', admin.site.urls), path('', include('polls.urls')) ]
Does anyone know how to solve this problem?
Thanks
P粉7764125972023-09-18 16:13:41
urlpatterns = [ path('', views.index, name="index"), path('', views.magamrol, name='Magamrol') ]
You need to change the name of a URL path, for example:
path('magamrol/', views.magamrol, name='Magamrol')
When you use two identical endpoints, conflicts may occur.