Hi I am trying to create my first Django project and having issues getting an app to work inside my Django project. I simply am trying to map the url code 8000/home1/hello/ to display the basic text “hello world” but failing to do so. I keep getting this error code:
Using the URLconf defined in web3.urls, Django tried these URL patterns, in this order:
admin/
The current path, home1/hello, didn’t match any of these. but still can not figure out why my code is not working….
Here is what I have done:
- created a django project named web3
- created an app called home1 and added a urls.py file to this app
- updated the settings.py folder INSTALLE_APPS to have ‘home1.apps.Home1Config’,
- home1 > urls.py includes this code:
from django.urls import path
from . import views
`urlpatterns = [
path('hello/', views.hello_world, name="hello_world"),
]
`
- home1>views.py includes this code:
`
from django.shortcuts import render
from django.http import HttpResponse
def hello_world(request):
return HttpResponse("you finally did it justin")`
6.web3> urls.py includes this code:
`from django.contrib import admin
from django.urls import path, include
from home1.views import hello_world # Import the hello_world view function
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('home1.urls')),
]
`
- I am pretty confident my file outlay is correct as I used the basic code to create the files (django-admin startproject web3) and (python manage.py startapp home1)
I am fully lost on this one… any help would be greatly appreciate!!!
Justin543543 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.