Tutorial help Blank Front page

2017-08-11 Thread Kareem Hart
I am currently doing the tutorial and I'm writing views.

I wrote my index.html file and updated the view to use a loader and add the 
extra code that they provided. It tells me next to load 
127.0.0.1:8000/polls and I should see a bulleted list containing the "whats 
up" question but my page is blank. 

Also when I point my browser towards the http://127.0.0.1:8000/, it gives 
me the following error.

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.


So I checked the code for mysite.urls.


from django.conf.urls import url, include

from django.contrib import admin


urlpatterns = [

url(r'^polls/', include('polls.urls')),

url(r'^admin/', admin.site.urls),

]

I ran the following command and got no issues.
$python manage.py check 



-- 
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+unsubscr...@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/c7383a02-dd7f-407d-9ea0-297e8ca85c4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Tutorial writing views help

2017-08-11 Thread Kareem Hart
I am currently up to the "writing views" part of the tutorial and just 
wrote the polls/index.html template. I updated the view in polls/view.py as 
such:

from django.http import HttpResponse
from django.template import loader

from .models import Question

def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
template = loader.get_template('polls/index.html')
context = {
'latest_question_list': latest_question_list,
}
return HttpResponse(template.render(context,request))

def detail(request,question_id):
return HttpResponse("You're looking at question %s." % question_id)

def results(request,question_id):
response = "You're looking at the results of question%s."
return HttpResponse(response % question_id)

def vote(request,question_id):
return HttpResponse("You're voting on question %s." % question_id)




I ran  $python manage.py check and the system identified no issues.
When I open the page *127.0.0.1:8000/polls/* I  get a blank page instead of 
a bulleted list of the questions I created.

Also I get the following error when I load *127.0.0.1:8000/polls/.*

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.


*mysite.urls*


from django.conf.urls import url, include

from django.contrib import admin



urlpatterns = [

url(r'^polls/', include('polls.urls')),

url(r'^admin/', admin.site.urls),

]

-- 
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+unsubscr...@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/452bc401-661b-4edd-950c-7ce90e0814e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial writing views help

2017-08-14 Thread Kareem Hart
*Here is my template.*
 

> *index.html*
>>
>
{% if latest_question_list %}

{% for question in latest_question %}
{{question.question_text}}
{% endfor %}

{% else %}
No polls are available.
{% endif %} 


*Here is my command prompt log.*

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\HP>cd mysite/

C:\Users\HP\mysite>python manage.py check
System check identified no issues (0 silenced).

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

System check identified no issues (0 silenced).
August 14, 2017 - 14:37:00
Django version 1.11.4, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[14/Aug/2017 14:37:06] "GET /polls/ HTTP/1.1" 200 25
Not Found: /favicon.ico
[14/Aug/2017 14:37:06] "GET /favicon.ico HTTP/1.1" 404 2069
Not Found: /
[14/Aug/2017 14:37:11] "GET / HTTP/1.1" 404 2018
Not Found: /
[14/Aug/2017 14:37:24] "GET / HTTP/1.1" 404 2018

-- 
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+unsubscr...@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/84d87c28-c274-415b-98b3-0bd51d9b4a93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial writing views help

2017-08-14 Thread Kareem Hart

>
> *I've found my mistake with the index.html file.*
>

  {% for question in latest_question %}
{{question.question_text}} 

herf is suppose to be href.

But  http://127.0.0.1:8000/  still says page not found.

-- 
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+unsubscr...@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/5403110a-751c-4fae-84d5-0aa0906e14d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.