Thursday, November 7, 2024

Re: NOT DISPLAYING PAGE

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:


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

urlpatterns = [
    path('', include('land.urls')),
    path('admin/', admin.site.urls),
]

With this configuration, the land app's URLs are included at the root level, allowing you to access http://localhost:8000/pen directly.

On Fri, Nov 8, 2024 at 4:26 AM Kennedy Saavedra <ksaavedrasu@gmail.com> wrote:
HElllo my friend. In the url path for "pen" add "/" after pen. Try and lest us know. Successes and blessed colleague

El jue, 7 nov 2024 a las 10:49, Heman Okumbo (<hemanokumbo@gmail.com>) escribió:
Hello everyone,my project is not displaying the page on the browser though I've followed the Django project tutorial.
my project urls:


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

urlpatterns = [
    path('land/', include('land.urls')),path('admin/', admin.site.urls),]


my app is called land,the urls are:


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),
]
when i access the page on local host  ie ,,,,8000/land/ and app urls to path('',views.tome),,the tome function is displayed 
But when i do ..….8000/pen/ i get an error that the path pen/ could not be found.
What should i do?

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/django-users/CAJt9CbhjZJUuLHEAC0VuqeDqraiDGFW8VxZBwp0YLNJ8m5BXTw%40mail.gmail.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/django-users/CAL-qgjdY8Wn70zDEHkbSyzpAzZ1wZpd8DUzRj0JapSmXRju33Q%40mail.gmail.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/django-users/CAPCf-y53DqtMxhLsJJg7uBrDW_Z-06ZSBnhT7NW01i2a64K2QA%40mail.gmail.com.

No comments:

Post a Comment