Discussion:
Page not found (404).Please check i am unable to run server.It is showing error
Avitab Ayan Sarmah
2018-05-25 17:18:53 UTC
Permalink
In my windoes powershell:

PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django 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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027

In 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:

1. polls/
2. 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.
--
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.
Daniel Hepper
2018-05-25 17:37:24 UTC
Permalink
What would you expect the server to display for that URL?

— Daniel
Post by Avitab Ayan Sarmah
PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django 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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
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 to False, and Django will display a standard 404 page.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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.
--
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/59C29748-4CD8-49AB-8A35-04E4B50FB268%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Avitab Ayan Sarmah
2018-05-25 17:42:26 UTC
Permalink
It should prompt a page for Question and last published
Post by Daniel Hepper
What would you expect the server to display for that URL?
— Daniel
PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django 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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
1. polls/
2. 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.
--
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
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
<https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the
Google Groups "Django users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-users/YJY0LJ8udW4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
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/59C29748-4CD8-49AB-8A35-04E4B50FB268%40gmail.com
<https://groups.google.com/d/msgid/django-users/59C29748-4CD8-49AB-8A35-04E4B50FB268%40gmail.com?utm_medium=email&utm_source=footer>
.
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+***@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/CAEx5wm5nj8Mq8SjxA6gHjRApBc03ZuQjmeGvOK-xb3vN1RcCvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Fidel Leon
2018-05-25 18:39:38 UTC
Permalink
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 166*

You 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 461*

You 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 in mysite.urls, Django tried these URL patterns,
1. *polls/*
1. *admin/*
The empty path didn't match any of these.
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 (<
PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django 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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
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
1. polls/
2. 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.
--
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
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
<https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Fidel Leon
***@flm.cat
Phone: +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/CAHXg%3DN2dRs9M%2Bx4_VJ%3D5kvefO%2BS27R_MODPjt7YW-xywES3RtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Dmitry Sobolev
2018-05-26 08:52:31 UTC
Permalink
Tell us please how to rout to "/"
I tried like this:
path('/', admin.site.urls)
and got the syntax error
Post by Fidel Leon
You may not realize it, but that's how Django works.
*[25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166*
You 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 461*
You 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
Using the URLconf defined in mysite.urls, Django tried these URL
1. *polls/*
1. *admin/*
The empty path didn't match any of these.
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.
PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django 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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
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
1. polls/
2. 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.
--
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
<javascript:>.
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
<https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Fidel Leon
Phone: +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/3b51c4d1-8c81-4f1b-8e46-e8f11badf824%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dmitry Sobolev
2018-05-26 12:48:15 UTC
Permalink
<Loading Image...> so
why the main page begins to work when we commenting this stroke even If we DON'T
have an url which routes to "/" ?
Post by Fidel Leon
You may not realize it, but that's how Django works.
*[25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166*
You 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 461*
You 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
Using the URLconf defined in mysite.urls, Django tried these URL
1. *polls/*
1. *admin/*
The empty path didn't match any of these.
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.
PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django 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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
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
1. polls/
2. 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.
--
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
<javascript:>.
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
<https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Fidel Leon
Phone: +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.
Samuel Brunel
2018-05-26 13:05:19 UTC
Permalink
Hi,

mysite.urls:

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

urlpatterns = [
path('polls/', include('polls.urls')),
# To route to ‘/'
path('', admin.site.urls),
]



http://127.0.0.1:8000 <http://127.0.0.1:8000/> : Route to admin urls
http://127.0.0.1:8000/polls/ <http://127.0.0.1:8000/polls/> : Route to polls urls



polls.urls:


from . import views
from django.urls import path

urlpatterns = [
path('', views.index, name='index'),
]

‘’ Because Django removes 'http://127.0.0.1:8000/polls/ <http://127.0.0.1:8000/polls/> '

Regards,

Sam
<https://lh3.googleusercontent.com/-zwPrLwvWaEM/WwlXVNFGEiI/AAAAAAAAZIk/7KMgI2diTfARkiG5xZmUeX4o7NyahQQVQCLcBGAs/s1600/Screen%2BShot%2B2018-05-26%2Bat%2B3.44.00%2BPM.png> so why the main page begins to work when we commenting this stroke even If we DON'T have an url which routes to "/" ?
You may not realize it, but that's how Django works.
[25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166
You tried to open http://127.0.0.1:8000/polls/ <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 461
You tried to open http://127.0.0.1:8000/polls/1/ <http://127.0.0.1:8000/polls/1/> and it WORKED (status 200)
Not Found: /
polls/
admin/
The empty path didn't match any of these.
You ONLY have urls for polls/ and admin/, and you're trying to open http://127.0.0.1:8000/ <http://127.0.0.1:8000/>
You DON'T have an url which routes to "/", hence you get a 404.
PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django version 2.0.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/ <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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/ <http://127.0.0.1:8000/>
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 to False, and Django will display a standard 404 page.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
Visit this group at https://groups.google.com/group/django-users <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 <https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
--
Fidel Leon
Phone: +34 622 26 44 92
--
You received this message because you are subscribed to the Google Groups "Django users" group.
Visit this group at https://groups.google.com/group/django-users <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 <https://groups.google.com/d/msgid/django-users/0b2bbcbb-57ef-4c7c-8853-e5e819e16d4a%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout <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+***@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/5ED1769D-9BA8-477B-8DFA-4BFB8C9FD384%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Dmitry Sobolev
2018-05-26 15:27:03 UTC
Permalink
<Loading Image...>

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?
Post by Samuel Brunel
Hi,
from django.contrib import admin
from django.urls import path
from django.urls import include
urlpatterns = [
path('polls/', include('polls.urls')),
# To route to ‘/'
path('', admin.site.urls),
]
http://127.0.0.1:8000 : Route to admin urls
http://127.0.0.1:8000/polls/ : Route to polls urls
from . import views
from django.urls import path
urlpatterns = [
path('', views.index, name='index'),
]
‘’ Because Django removes 'http://127.0.0.1:8000/polls/ '
Regards,
Sam
<https://lh3.googleusercontent.com/-zwPrLwvWaEM/WwlXVNFGEiI/AAAAAAAAZIk/7KMgI2diTfARkiG5xZmUeX4o7NyahQQVQCLcBGAs/s1600/Screen%2BShot%2B2018-05-26%2Bat%2B3.44.00%2BPM.png> so
why the main page begins to work when we commenting this stroke even If we DON'T
have an url which routes to "/" ?
Post by Fidel Leon
You may not realize it, but that's how Django works.
*[25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166*
You 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 461*
You 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
Using the URLconf defined in mysite.urls, Django tried these URL
1. *polls/*
1. *admin/*
The empty path didn't match any of these.
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 (<
PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django 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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
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
1. polls/
2. 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.
--
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
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
<https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Fidel Leon
Phone: +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
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
<https://groups.google.com/d/msgid/django-users/0b2bbcbb-57ef-4c7c-8853-e5e819e16d4a%40googlegroups.com?utm_medium=email&utm_source=footer>
.
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+***@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/18de33de-eea9-4f3c-bd91-826152677cac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dylan Reinhold
2018-05-26 15:32:49 UTC
Permalink
You asked how to map admin to root. So yes it is correct then when you go
to the root if you are not loged in you will get he admin sign on.

If your goal was to map the polls application to root, then put the admin
back to the way it was
path('admin/', admin.site.urls),

And change polls to
path('', include('polls.urls')),

Dylan
Post by Dmitry Sobolev
<https://lh3.googleusercontent.com/-iyXA6xDhmM4/Wwl8QnGSPmI/AAAAAAAAZIw/6asAx92uuYsSM-Mm3b8RXvmLOSBfEkK1ACLcBGAs/s1600/Screen%2BShot%2B2018-05-26%2Bat%2B6.24.27%2BPM.png>
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?
Post by Samuel Brunel
Hi,
from django.contrib import admin
from django.urls import path
from django.urls import include
urlpatterns = [
path('polls/', include('polls.urls')),
# To route to ‘/'
path('', admin.site.urls),
]
http://127.0.0.1:8000 : Route to admin urls
http://127.0.0.1:8000/polls/ : Route to polls urls
from . import views
from django.urls import path
urlpatterns = [
path('', views.index, name='index'),
]
‘’ Because Django removes 'http://127.0.0.1:8000/polls/ '
Regards,
Sam
<https://lh3.googleusercontent.com/-zwPrLwvWaEM/WwlXVNFGEiI/AAAAAAAAZIk/7KMgI2diTfARkiG5xZmUeX4o7NyahQQVQCLcBGAs/s1600/Screen%2BShot%2B2018-05-26%2Bat%2B3.44.00%2BPM.png> so
why the main page begins to work when we commenting this stroke even If we DON'T
have an url which routes to "/" ?
Post by Fidel Leon
You may not realize it, but that's how Django works.
*[25/May/2018 22:44:15] "GET /polls/ HTTP/1.1" 200 166*
You 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 461*
You 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
Using the URLconf defined in mysite.urls, Django tried these URL
1. *polls/*
1. *admin/*
The empty path didn't match any of these.
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 (<
PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
May 25, 2018 - 22:42:50
Django 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 2027
Not Found: /favicon.ico
[25/May/2018 22:43:02] "GET /favicon.ico HTTP/1.1" 404 2078
Not 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 461
Not Found: /
[25/May/2018 22:44:27] "GET / HTTP/1.1" 404 2027
Not Found: /
[25/May/2018 22:45:01] "GET / HTTP/1.1" 404 2027
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
1. polls/
2. 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.
--
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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/ms
gid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40goog
legroups.com
<https://groups.google.com/d/msgid/django-users/85ba21bf-3c98-4bbe-877f-716eff7b73d2%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Fidel Leon
Phone: +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
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/ms
gid/django-users/0b2bbcbb-57ef-4c7c-8853-e5e819e16d4a%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/0b2bbcbb-57ef-4c7c-8853-e5e819e16d4a%40googlegroups.com?utm_medium=email&utm_source=footer>
.
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
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
<https://groups.google.com/d/msgid/django-users/18de33de-eea9-4f3c-bd91-826152677cac%40googlegroups.com?utm_medium=email&utm_source=footer>
.
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+***@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/CAHtg44ApB3DR9v_7Tewuub-azom_G6%2Bgq832GSSECVbmfwO2ng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...