Remove the slash /
Just do
localhost:8000/pen
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/django-users/CAJt9CbhjZJUuLHEAC0VuqeDqraiDGFW8VxZBwp0YLNJ8m5BXTw%40mail.gmail.com.
1. Project-Level urls.py Configuration:
Your project's urls.py currently includes:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('land/', include('land.urls')),
path('admin/', admin.site.urls),
]
This setup routes any URL starting with land/ to your land application's URL configurations. Therefore, accessing http://localhost:8000/land/ will look for further URL patterns defined in land/urls.py.
2. Application-Level urls.py Configuration:
In your land application's urls.py, you have:
from django.contrib import admin
from django.urls import path
from . import views
urlpatterns = [
path('pen', views.tome, name='pen'),
path('admin/', admin.site.urls),
]
Here, the pattern path('pen', views.tome, name='pen') expects the URL to be http://localhost:8000/land/pen due to the inclusion of land/ in the project-level urls.py. Therefore, to access the tome view, you should navigate to http://localhost:8000/land/pen.
3. Accessing the URL:
To access the tome view, use: http://localhost:8000/land/pen.
If you want to access the tome view directly via http://localhost:8000/pen, you'll need to adjust your project-level urls.py to include the land app without the land/ prefix:
land app's URLs are included at the root level, allowing you to access http://localhost:8000/pen directly.To view this discussion visit https://groups.google.com/d/msgid/django-users/CAL-qgjdY8Wn70zDEHkbSyzpAzZ1wZpd8DUzRj0JapSmXRju33Q%40mail.gmail.com.