I have following messages - django

Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/info
Using the URLconf defined in mysites.urls, Django tried these URL patterns, in this order:
^ ^$ [name='index']
^info/
^admin/
The current path, info, 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.

Issue is that you have to use url(r'^$' or url(r'^ in your views and specify only full url in project dispatcher

Related

django 4.1 tutorial how to change the link on the admin page header from http://localhost:8000 to http://localhost:8000/polls/

In the Admin pages of the Polls Tutorial there is a link to "View Site" that has the URL http://localhost:8000/ but it should be http://localhost:8000/polls/ to list the polls in the indexView class.
I could not find where to change that View Site link.
Right now with the Polls Tutorial done and all working except this last little bit I want to get it done to use as a reference.
http://localhost:8000 now gives...
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
polls/
admin/
The empty path didn’t match any of these.
The best way for me was to change the "View Site" link in the admin header.
go to admin.py and set
admin.site.site_url = 'http://localhost:8000/instruction/'

save button not working in django

Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/post/new/blog/home_page.html
Using the URLconf defined in school.urls, Django tried these URL patterns, in this order:
^admin/
^$ [name='home_page']
^about/$ [name='about']
^event/$ [name='event']
^calendar/$ [name='calendar']
^contact/$ [name='contact']
^class_a/$ [name='class_a']
^login/$ [name='login']
^login_submit/$ [name='login_submit']
^class_info/$ [name='class_info']
^Ist_std/$ [name='Ist_std']
^IInd_std/$ [name='IInd_std']
^IIIrd_std/$ [name='IIIrd_std']
^IVth_std/$ [name='IVth_std']
^post/new/$ [name='post_new']
The current URL, post/new/blog/home_page.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 URL is not matching any of your defined URLs. If you want that page to show anything, you'll need to include a match like:
r'^/post/new/blog/home_page$'
In url.py and write a view for it to display the wanted html file.

Django url pattern doesn't match

I am using new Django 1.8 app to learn Django.
I am stumped as to how to get this my simple url to be resolved by urls.py
I create the url in another view as:
<a href="/photoview/{{photo.id}}/"}>
I can successfully pass this url to the browser as:
http://localhost:8000/photoview/300/
I am expecting that this url can be matched by the urls.py expression:
url('r^photoview/(?P<id>\d+)/$', views.photoview),
But this is not working. I have tried variations of this but none have worked so far, such as:
url('r^photoview/(?P<id>[0-9]+)/$', views.photoview),
I get this message in browser when it fails to match
Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/photoview/300/
Using the URLconf defined in asset.urls, Django tried these URL patterns, in this order:
^admin/
^$ [name='index']
^time/$
^about/$
^accounts/$
^photos/$
^tags/$
^users/$
r^photoview/(?P<id>\d+)/$
^static\/photos\/(?P<path>.*)$
The current URL, photoview/300/, didn't match any of these.
Appreciate any help getting this to work.
you have url('r^photoview/(?P<id>\d+)/$', views.photoview),
you want url(r'^photoview/(?P<id>\d+)/$', views.photoview),
(Note the r is in front of the string, not the first character)
As noted in docs.djangoproject.com/en/1.8/topics/http/urls,
The 'r' in front of each regular expression string is optional but
recommended. It tells Python that a string is “raw” – that nothing in
the string should be escaped
Also note that you should use a friendly name in your url definition (e.g. photoview) and then use {% url 'photoview' photo.id %} in your template instead of hardcoding the URL pattern.

Django Rest Framework 404 after browsable API login

I am following the Tutorial and everything else works fine. The only problem is that when I try to login using the Rest Framework browsable API, I get a 404 after the login:
Request URL: http://localhost:7000/accounts/profile/
Using the URLconf defined in shelter.urls, Django tried these URL patterns, in this order:
^times/
^admin/
^api-auth/
The current URL, accounts/profile/, didn't match any of these.
Times is the name of the app. The API login is redirecting to accounts/profile, I haven't set that url up so of course the response is a 404. I'm probably missing a simple and obvious step.

Url error in django social auth

I am using django social auth in my app and I found a Page not found error.
I have installed it in my app and also place it in my project parallel to my app.
And I have also add url to my url file
url(r'', include('social_auth.urls')),
But when it shows me the error It shows the list of url in my url file and where i have the required url which i am looking for.
The error page is as :
Page not found (404)
Request Method: GET
Request URL: http://abc.com/login/
Using the URLconf defined in webdev.urls, Django tried these URL patterns, in this order:
^$ [name='home']
^polls/
^admin/doc/
^admin/
^register1/
^edit/
^edit1/
^customerreg/
^checkout/
^checkout1/
^order/
^order1/
^upload/
^upload1/
^product/
^profile/
^logout/
^login/(?P<backend>[^/]+)/$ [name='socialauth_begin']
^complete/(?P<backend>[^/]+)/$ [name='socialauth_complete']
^associate/(?P<backend>[^/]+)/$ [name='socialauth_associate_begin']
^associate/complete/(?P<backend>[^/]+)/$ [name='socialauth_associate_complete']
^disconnect/(?P<backend>[^/]+)/$ [name='socialauth_disconnect']
^disconnect/(?P<backend>[^/]+)/(?P<association_id>[^/]+)/$ [name='socialauth_disconnect_individual']
The current URL, login/, didn't match any of these.
In the above list you can see that url file have that url , but it doesn't access that ??
^login/(?P<backend>[^/]+)/$ [name='socialauth_begin']
This url do not match with http://abc.com/login/ as the url pattern requires a backend parameter.
Something like this will match the url you are accessing, however there is no backend parameter there, so in view you may want to choose something default.
url(r'^login/$', 'your_view',),