in this case removing "admin/" from url pattern I get the login page?
Is that right? Where is the 1st page with the rocket? Should It loading after adding apps?
суббота, 26 мая 2018 г., 16:06:08 UTC+3 пользователь sbrunel62 написал:
Hi,mysite.urls:from django.contrib import adminfrom django.urls import pathfrom django.urls import includeurlpatterns = [path('polls/', include('polls.urls')),# To route to '/'path('', admin.site.urls),]http://127.0.0.1:8000 : Route to admin urlshttp://127.0.0.1:8000/polls/ : Route to polls urlspolls.urls:from . import viewsfrom django.urls import pathurlpatterns = [path('', views.index, name='index'),]'' Because Django removes 'http://127.0.0.1:8000/polls/' Regards,SamOn 26 May 2018, at 14:48, Dmitry Sobolev <prosto...@gmail.com> wrote:so why the main page begins to work when we commenting this stroke even If we DON'T have an url which routes to "/" ?
пятница, 25 мая 2018 г., 21:40:17 UTC+3 пользователь Fidel Leon написал:You may not realize it, but that's how Django works.From your server log:[25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166You tried to open http://127.0.0.1:8000/polls/ and it WORKED (status 200)[25/May/2018 22:44:18] "GET /polls/1/ HTTP/1.1" 200 461You tried to open http://127.0.0.1:8000/polls/1/ and it WORKED (status 200)Not Found: /You try to open http://127.0.0.1:8000/ and it DIDN'T work. The error message says it CLEAR:Using the URLconf defined inmysite.urls
, Django tried these URL patterns, in this order:
- polls/
The empty path didn't match any of these.
- admin/
You ONLY have urls for polls/ and admin/, and you're trying to open http://127.0.0.1:8000/You DON'T have an url which routes to "/", hence you get a 404.El vie., 25 may. 2018 a las 19:19, Avitab Ayan Sarmah (<avita...@gmail.com>) escribió:In my windoes powershell:PS C:\Users\AVITABAYAN\mysite> python manage.py runserverPerforming system checks...System check identified no issues (0 silenced).May 25, 2018 - 22:42:50Django version 2.0.1, using settings 'mysite.settings'Starting development server at http://127.0.0.1:8000/Quit the server with CTRL-BREAK.Not Found: /[25/May/2018 22:43:01] "GET / HTTP/1.1" 404 2027Not Found: /favicon.ico[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078Not Found: /[25/May/2018 22:43:15] "GET / HTTP/1.1" 404 2027[25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166[25/May/2018 22:44:15] "GET /static/polls/style.css HTTP/1.1" 304 0[25/May/2018 22:44:15] "GET /static/polls/images/background.gif HTTP/1.1" 304 0 [25/May/2018 22:44:18] "GET /polls/1/ HTTP/1.1" 200 461Not Found: /[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027Not Found: /[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027In my server:Page not found (404)
Request Method: GET Request URL: http://127.0.0.1:8000/ 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.
You're seeing this error because you have
DEBUG = True
in your Django settings file. Change that toFalse
, and Django will display a standard 404 page.--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/85ba21bf- .3c98-4bbe-877f-716eff7b73d2% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
--Fidel LeonPhone: +34 622 26 44 92--
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 post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0b2bbcbb- .57ef-4c7c-8853-e5e819e16d4a% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/18de33de-eea9-4f3c-bd91-826152677cac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment