Страница не найдена 404 Django & Python
У меня возникает следующая ошибка
Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/ Using the URLconf defined in Decoder.urls, Django tried these URL patterns, in this order: form.html [name='form1'] hl7 [name='hl7'] The empty path didn’t match any of these. You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Я впервые пишу код с помощью Django
.`from django.contrib import admin from django.urls import path, include
urlpatterns = [ path('', include('hl7rest.urls')), ]`
и этот другой файл
from . import views
из django.urls import path
urlpatterns = [
path('form.html', views.render_form_View, name='form1'),
path('hl7', views.hl7_web_view ,name='hl7'),
]
Ваши пути не соответствуют запросу. Вы можете создать подкласс TemplateView для рендеринга вашего шаблона:
Виды
from django.views.generic.base import TemplateView
class HomePageView(TemplateView):
template_name = "display_form.html"
Шаблоны URL
urlpatterns = [
path('', HomePageView.as_view(), name='home')
]