Saturday, February 4, 2017

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

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.

On Saturday, February 4, 2017 at 2:24:13 AM UTC-2, Ryan Castner wrote:
You need to post some source code for us to see what is going on, you are likely missing some lines of code

On Friday, February 3, 2017 at 8:26:41 PM UTC-5, Dário Carvalho wrote:
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.

--
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/690796a7-cfa5-4ec0-a1bd-ebf99392f476%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment