0
votes

I am having the following error

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.

enter image description here

Its my first time writing code using Django

`from django.contrib import admin from django.urls import path, include

urlpatterns = [ path('', include('hl7rest.urls')), ]`

and this other file

from . import views

from django.urls import path

urlpatterns = [

path('form.html', views.render_form_View, name='form1'),

path('hl7', views.hl7_web_view ,name='hl7'),

]

1
None of your paths match with an empty string, hence requesting the / page makes no sense.Willem Van Onsem
How can I repair the nonsense of the empty string?Manuel Sebastian Blanco
well what view do you want to trigger if you visit 127.0.0.1:8000 ?Willem Van Onsem
the file display_form.htmlManuel Sebastian Blanco
that is not a view, but a template. A view does not per se renders a template, nor does it have to render at most one. A view simply should return a HTTP response, and can make use of tooing to assist with that.Willem Van Onsem

1 Answers

0
votes

Your paths don' t match the request. You can create a TemplateView subclass for render your template:

Views

from django.views.generic.base import TemplateView

class HomePageView(TemplateView):
    template_name = "display_form.html"

Url patterns

urlpatterns = [
    path('', HomePageView.as_view(), name='home')
]