Re: Tutorial part 3 help: bulleted-list

2016-10-18 Thread Johnny McClung
Thanks so much everyone. I looked over those files many times and I 
couldn't see it. 



On Tuesday, October 18, 2016 at 5:17:55 PM UTC-4, James Schneider wrote:
>
>
>
> On Tue, Oct 18, 2016 at 11:00 AM, Johnny McClung <jdmc...@gmail.com 
> > wrote:
>
>> I have gotten down to the part where the tutorial reads "Load the page by 
>> pointing your browser at “/polls/”, and you should see a bulleted-list 
>> containing the “What’s up” question from Tutorial 2. The link points to the 
>> question’s detail page."
>>
>> I do not see a bulleted-list. All I see is "No polls are available."
>>
>> This makes me think that I have an error in the if statement in the 
>> template index.html. However, I can not find the error or why it is not 
>> showing me the list. Any help would be appreciated. 
>>
>
> The {% if %} statement is fine. 
>
>  
>
>> mysite>>polls>>templates>>polls>>index.html
>>
>> {% if latest_question_list %}
>> 
>> {% for quesion in latest_question_list %}
>>
>
> You do have a typo in your {% for %} loop, however.
>
>
>
>  
>
>> def index(request):
>> latest_question_list = Question.objects.order_by('-pub_date')[:5]
>> template = loader.get_template('polls/index.html')
>> context = {'latest_quesion_list': latest_question_list,}
>> return HttpResponse(template.render(context, request))
>>
>>
> This is where your issue is. Your template context dictionary also has the 
> same typo as  your  {% for %} loop, so the {% if %} statement is returning 
> False because the variable it is checking (which is spelled correctly) 
> doesn't exist.
>
> -James
>

-- 
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/23054cef-e165-48b6-b75d-87c8dd81830b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Tutorial part 3 help: bulleted-list

2016-10-18 Thread Johnny McClung
I have gotten down to the part where the tutorial reads "Load the page by 
pointing your browser at “/polls/”, and you should see a bulleted-list 
containing the “What’s up” question from Tutorial 2. The link points to the 
question’s detail page."

I do not see a bulleted-list. All I see is "No polls are available."

This makes me think that I have an error in the if statement in the 
template index.html. However, I can not find the error or why it is not 
showing me the list. Any help would be appreciated. 

mysite>>polls>>templates>>polls>>index.html

{% if latest_question_list %}

{% for quesion in latest_question_list %}
{{ question.question_text 
}}
{% endfor %}

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


mysite>>polls>>urls.py
from django.conf.urls import url


from . import views

urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P[0-9]+)/$', views.detail, name='detail'),
url(r'^(?P[0-9]+)/results/$', views.results, 
name='results'),
url(r'^(?P[0-9]+)/vote/$', views.vote, name='vote'),
]


.
mysite>>polls>>views.py
from django.shortcuts import render

# Create your views here.
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_quesion_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 HttpResonse(response % question_id)

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

-- 
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/f0899689-fb34-4728-8ec6-7bfc661c348c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error with Tutorial - Writing your first Django app, part 1

2016-10-10 Thread Johnny McClung
Thank you. I've added the comma as you mentioned. Can't believe I missed 
that. But now I am getting a new error. 



E:\Dropbox\Python Scripts\mysite>python manage.py runserver
Performing system checks...

Unhandled exception in thread started by .wrapper at 0x044B16A8>
Traceback (most recent call last):
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\urls\resolvers.py",
 
line 315, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\autoreload.py",
 
line 226, in wrapper
fn(*args, **kwargs)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\commands\runserver.py",
 
line 121, in inner_run
self.check(display_num_errors=True)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py",
 
line 374, in check
include_deployment_checks=include_deployment_checks,
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py",
 
line 361, in _run_checks
return checks.run_checks(**kwargs)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\registry.py",
 
line 81, in run_checks
new_errors = check(app_configs=app_configs)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py",
 
line 14, in check_url_config
return check_resolver(resolver)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py",
 
line 28, in check_resolver
warnings.extend(check_resolver(pattern))
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py",
 
line 24, in check_resolver
for pattern in resolver.url_patterns:
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py",
 
line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\urls\resolvers.py",
 
line 322, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf '' 
does not appear to have any patterns in it. If you see valid patterns in 
the file then the issue is probably caused by a circular import.



-- 
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/c2742620-55fc-4db1-b92a-2dfc392d8903%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Error with Tutorial - Writing your first Django app, part 1

2016-10-10 Thread Johnny McClung
I am getting an error when I try to run the Django server. 

>> mysite >> polls >> urls.py
from django.conf.urls import url


from . import views

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




>> mysite >> mysite >> urls.py
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),
]



Error:

E:\Dropbox\Python Scripts\mysite>python manage.py runserver
Performing system checks...

Unhandled exception in thread started by .wrapper at 0x03F616A8>
Traceback (most recent call last):
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\autoreload.py",
 
line 226, in wrapper
fn(*args, **kwargs)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\commands\runserver.py",
 
line 121, in inner_run
self.check(display_num_errors=True)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py",
 
line 374, in check
include_deployment_checks=include_deployment_checks,
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py",
 
line 361, in _run_checks
return checks.run_checks(**kwargs)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\registry.py",
 
line 81, in run_checks
new_errors = check(app_configs=app_configs)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py",
 
line 14, in check_url_config
return check_resolver(resolver)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py",
 
line 24, in check_resolver
for pattern in resolver.url_patterns:
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py",
 
line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\urls\resolvers.py",
 
line 313, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py",
 
line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\urls\resolvers.py",
 
line 306, in urlconf_module
return import_module(self.urlconf_name)
  File 
"C:\Users\geek\AppData\Local\Programs\Python\Python35-32\lib\importlib\__init__.py",
 
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 986, in _gcd_import
  File "", line 969, in _find_and_load
  File "", line 958, in _find_and_load_unlocked
  File "", line 673, in _load_unlocked
  File "", line 661, in exec_module
  File "", line 767, in get_code
  File "", line 727, in source_to_code
  File "", line 222, in 
_call_with_frames_removed
  File "E:\Dropbox\Python Scripts\mysite\mysite\urls.py", line 21
url(r'^admin/', admin.site.urls),
  ^
SyntaxError: invalid syntax


Any help would be appreciated. Thank you. 

-- 
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/9a44648b-dfc1-476a-be2f-12b74328e6d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.