Django documentation tutorial part 1

93 views
Skip to first unread message

Philip

unread,
Feb 6, 2017, 9:12:30 PM2/6/17
to Django users
Hello,

I am working through the tutorial included with the django documentation, and I am confused as to why my url is not working. I have the most recent versions of django and python (the ones that the tutorial says to use) and I believe my file structure is correct, you can see it on  https://github.com/philipkiely/docexample to verify. However, I get a 404 error when I try localhost:8000/polls/, where the documentation tutorials says that I should be seeing the page that I built.

Thank you,

Philip

Sergiy Khohlov

unread,
Feb 6, 2017, 9:21:59 PM2/6/17
to django-users
I have not seen  setting.py in your project . Also could you please  send your runserver command  and output

Many thanks,

Serge


+380 636150445
skype: skhohlov

--
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...@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/cd2c6578-2029-484e-96d6-816fe3b16163%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dário Carvalho

unread,
Feb 6, 2017, 9:58:48 PM2/6/17
to Django users
The "urls.py" at docexample should look like:

"""mysite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
    url(r'^polls/', include('polls.urls')),
    url(r'^admin/', admin.site.urls),
]

I think it's going to work now.

Philip

unread,
Feb 6, 2017, 11:35:51 PM2/6/17
to Django users

Not Found: /polls/

[06/Feb/2017 23:34:00] "GET /polls/ HTTP/1.1" 404 1925

Not Found: /polls/

[06/Feb/2017 23:34:01] "GET /polls/ HTTP/1.1" 404 1925


Above is my console output. My run server command is python3 manage.py runserver. I need to use python3 as the command otherwise it does not work at all.


On Monday, February 6, 2017 at 3:21:59 PM UTC-6, Sergiy Khohlov wrote:
I have not seen  setting.py in your project . Also could you please  send your runserver command  and output

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Mon, Feb 6, 2017 at 7:49 PM, Philip <phil...@gmail.com> wrote:
Hello,

I am working through the tutorial included with the django documentation, and I am confused as to why my url is not working. I have the most recent versions of django and python (the ones that the tutorial says to use) and I believe my file structure is correct, you can see it on  https://github.com/philipkiely/docexample to verify. However, I get a 404 error when I try localhost:8000/polls/, where the documentation tutorials says that I should be seeing the page that I built.

Thank you,

Philip

--
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.

Philip

unread,
Feb 6, 2017, 11:46:52 PM2/6/17
to Django users
Thanks to the link you posted, I figured it out! I had the url in the wrong urls file. Thank you so much!!!!!!!!!

Philip

unread,
Feb 6, 2017, 11:47:17 PM2/6/17
to Django users

Philip

unread,
Feb 6, 2017, 11:47:46 PM2/6/17
to Django users
Solved.


On Monday, February 6, 2017 at 3:12:30 PM UTC-6, Philip wrote:

Dário Carvalho

unread,
Feb 7, 2017, 1:35:26 AM2/7/17
to Django users
You welcome. I'm new in django too.

Gerald Brown

unread,
Feb 7, 2017, 11:08:48 PM2/7/17
to Django users
Have you tried using "127.0.0.1" instead of "localhost"?  I had a similar problem when I used "localhost"

Dário Carvalho

unread,
Feb 14, 2017, 5:47:27 PM2/14/17
to django...@googlegroups.com
I'm seeing your post only know. Sorry. In deed I used 127.0.0.1:8000 without the /polls when I first ran the server. When I tried with the /polls could finally see the page. 

--
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/d45I92r6cCo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Alexis Carmona

unread,
Feb 14, 2017, 9:29:30 PM2/14/17
to Django users
Hey, I checked your code on githubt and i think that you missed yo import your views in your urls file

Dário Carvalho

unread,
Feb 15, 2017, 10:28:14 PM2/15/17
to django...@googlegroups.com
Yeah, was that.

--
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/d45I92r6cCo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages