I really need help pls assist this error

166 views
Skip to first unread message

Listenable Music

unread,
Apr 30, 2020, 8:06:07 AM4/30/20
to Django users
1st error in http://127.0.0.1:8000/ i dont know why I don't see any error

Page not found (404)

Request Method:GET
Request URL:http://127.0.0.1:8000/

Using the URLconf defined in wisdompets.urls, Django tried these URL patterns, in this order:

  1. admin/
  2. ^$ [name='home']
  3. ^adoptions/(\d+)/ [name='pet_detail']

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.



2nd Error filename views.py

from django.contrib import admin
from django.urls import path
from adoptions import views

urlpatterns = [
path('admin/', admin.site.urls),
path(r'^$', views.home, name='home'),
path(r'^adoptions/(\d+)/', views.pet_detail, name='pet_detail'),
]




3rd error filename 


from django.contrib import admin
from django.urls import path
from adoptions import views

urlpatterns = [
path('admin/', admin.site.urls),
path(r'^$', views.home, name='home'),
path(r'^adoptions/(\d+)/', views.pet_detail, name='pet_detail'),
]



4th error in terminal


WARNINGS:

?: (2_0.W001) Your URL pattern '^$' [name='home'] has a route that contains '(?P<', begins with a '^', or ends with a '$'. This was likely an oversight when migrating to django.urls.path().

?: (2_0.W001) Your URL pattern '^adoptions/(\d+)/' [name='pet_detail'] has a route that contains '(?P<', begins with a '^', or ends with a '$'. This was likely an oversight when migrating to django.urls.path().


System check identified 2 issues (0 silenced).

April 30, 2020 - 09:22:25

Django version 3.0.5, using settings 'wisdompets.settings'

Starting development server at http://127.0.0.1:8000/

Quit the server with CONTROL-C.

Not Found: /

[30/Apr/2020 09:22:29] "GET / HTTP/1.1" 404 2176

Not Found: /

[30/Apr/2020 09:22:53] "GET / HTTP/1.1" 404 2176







Jorge Gimeno

unread,
Apr 30, 2020, 1:59:56 PM4/30/20
to django...@googlegroups.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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b28044c2-c7f6-4cd8-a5e1-a20d9d8abfd1%40googlegroups.com.

In Django 2.0+, path objects were introduced.  They do not use eegular expressions like url objects did.  They use strings.  You can see examples in the docs here:  


If you want to use regular expressions still, I believe they are re-path objects.  See the link above.

Hope this helps! 

-Jorge


Reply all
Reply to author
Forward
Message has been deleted
0 new messages