issue with django's example version 1.10 in windows 7 ultimate

43 views
Skip to first unread message

Dário Carvalho

unread,
Feb 3, 2017, 8:26:41 PM2/3/17
to Django users
Hi. I'm new in django and in python either and of course as I'm new in django, I installed 1.10's version and by the way I use windows 7 ultimate x86. So, I was trying to make work the example at https://docs.djangoproject.com/en/1.10/intro/ but in the first tutorial's part I got some error message telling me that django couldn't find neither ^admin nor ^polls then I got confused and started searching a way for making it works but I found information about old django's versions. But the way I'm using python 3.6. Then I ask you all if you know what I've done wrong. If needed I can send the exactly message django displayed when I ran the server. Please, I've got to get help with this.

Ryan Castner

unread,
Feb 3, 2017, 11:24:13 PM2/3/17
to Django users
You need to post some source code for us to see what is going on, you are likely missing some lines of code

Dário Carvalho

unread,
Feb 4, 2017, 11:57:43 AM2/4/17
to Django users
First I used this sequence with cmd:

cd %userprofile%
django-admin startproject mysite
python manage.py startapp polls
 
Before I updated the ".\mysite\polls\views.py" and now it looks like:

from django.shortcuts import render

# Create your views here.
from django.http import HttpResponse


def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

Then I created ".\mysite\urls.py"(Because there was none) and it looks like:

from django.conf.urls import url

from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
]

And then updated urls.py at ".\mysite\mysite\"(".\mysite\mysite\urls.py"), without the documentation:

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),
]

Before that I ran the server with "python manage.py runserver" at "C:\%userprofile%\mysite". But when I loaded 127.0.0.1:8000 that's what I saw:

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 current URL, , 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.


At this point the site says that the borowser displays the message:

Hello, world. You're at polls index.

Hope someone could help me cause I really need to learn Django.

Daniel Roseman

unread,
Feb 5, 2017, 6:53:41 AM2/5/17
to Django users
The instructions say to go to http://localhost:8000/polls/ in your browser. You're going to http://localhost:8000/, but there's nothing defined for that URL.
--
DR.

Dário Carvalho

unread,
Feb 5, 2017, 8:04:42 AM2/5/17
to Django users
Thanks. I didn't noticed that.
Reply all
Reply to author
Forward
0 new messages