Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/about/ Using the URLconf defined in
Hello.urls, Django tried these URL patterns, in this order:
admin/ admin/ [name='home'] service [name='service'] contact
[name='contact'] about [name='about'] The current path, about/, didn't
match any of these.[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/jZMW9.png
You are getting this warning because you haven't defined a pattern that will direct the user to that page. So if you are doing this in a new application or the root part? Inform us about that. Either way you should go to "urls" and add the path to that folder. You can use the default "admin/" to teach you. For examle delete admin and write "abc/" and when you write"/abc" to your browser it'll show up.
Related
I'm following this tutorial:https://www.w3schools.com/django/django_views.php
After copying all the code to create the members and admin views I get this error:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Using the URLconf defined in myworld.urls, Django tried these URL patterns, in this order:
members/
admin/
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.
In your project urls.py you set the path to the members app to use 127.0.0.1:8000/members
In order to navigate to 127.0.0.1:8000/members using the default route, you need to change the path to look like this :
path('', include('members.urls')),
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/polls/'polls/index.html
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
admin/
^polls/ ^$ [name='index']
^polls/ ^(?P<question_id>[0-9]+)/$ [name='detail']
^polls/ ^(?P<question_id>[0-9]+)/results$ [name='results']he current path, polls/'polls/index.html, 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.
Your problem is not about IDE, you need to properly configure your urls.py page. It seems like Django couldn't find 'polls/'polls/index.html' address. You need to go to urls.py file and add following line;
path('polls/'polls/index.html/', views.path_to_function, name='index'),
I'm trying to run this library. I downloaded and copied it on my desktop, then i tried to run it using:
py -3.7 manage.py runserver
I got:
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
But when i go to that url i keep getting this error:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Using the URLconf defined in django_google_authenticator.urls, Django tried these URL patterns, in this order:
^admin/login/$
^admin/
The empty path didn't match any of these.
I don't understand what's wrong, can someone help me? Thanks in advance!
I think thats the normal behavour of Django, as you can see it is saying that your path didn't match any of the configured ones, like admin, so why don't you try http://127.0.0.1:8000/admin/to access Django Admin login page.
If you want to see something different from a 404 with the base url you need to configure your urls and maybe add a redirect view, in that way when the base url is use it will redirect to your admin or other preferred page.
Trying to deploy my Django app on virtual shared server. All works as expected until I try to log in to the admin app. I think it may have something to do with the way that the server deals with posts (had a similar problem with Flask). The setup works fine on my local machine.
I can get to the admin login page, but when I submit my credentials I get a 404 error. In debug mode the response is:
Page not found (404)
Request Method: POST
Request URL: https://lindcraft.williesworkshop.com/admin/login/
Raised by: django.contrib.admin.sites.login
Using the URLconf defined in lindcraft.urls, Django tried these URL patterns, in this order:
admin/
^[P|p]roducts?/(?P<prod_id>\d{0,3})/$ [name='product']
^[P|p]rices?/?$ [name='prices']
^[P|p]arking [name='parkingIntro']
^[D|d]isplay [name='displayIntro']
^[C|c]ontact [name='contact']
^[A|a]bout [name='about']
^$ [name='index']
The current path, login/, didn't match any of these.
The project urls.py is:
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('www.urls')),]
Django seems to be looking for "login/" instead of "admin/" even though the "request URL" is "... /admin/login/" The admin part is striped off somehow.
Funny thing is, the exception seems to be raised by django.contrib.admin.sites.login as though the request actually made it to admin.
It seems to me that the same URL works with a GET but not with a POST.
Can anyone offer any insight?
FWIW, my hosting service (a2hosing) uses something called passenger to manage python requests. There may, or may not be a ngnix server used too.
TIA!
In browser I get:
Request URL: http://xxxxxx:8000/person/test/
Using the URLconf defined in person.urls, Django tried these URL patterns, in this order:
^person/ ^$
^person/ ^person/(?P<slug>[-\w]+)/$
^admin/
The current URL, person/test/, didn't match any of these.
In python shell I get:
import re
url = 'person/test/'
pattern = re.compile(r'^person/(?P<slug>[-\w]+)/$'
re.match(pattern,url)
<_sre.SRE_Match object at 0xb7716860>
So it obviously should match the regexp.
Using only url person/ (the ^$ regexp) does work.
I've tried restarting the development server of course. What could be wrong here?
It isn't matching against r'^person/(?P<slug>[-\w]+)/$', the 404 page shows that it's matching against r'^person/person/(?P<slug>[-\w]+)/$'
You've probably matched ^person/ in a urls.py, then imported another urls.py and put "person" in there also. Remove it from the second urls.py. After importing, a secondary urls.py only has to match the rest of the URL, not the whole URL.