Let's see the whole error page.
On Sunday, 22 July 2012 23:43:59 UTC+2, Ricardo Cardoso wrote:
>
> Thank you for your input guys.
>
> Sadly, i had already checked it Carlos and have my templates for polls
> under:
> /home/my_user/Webdev/Templates/polls
>
> In this case my template dir is set up as:
> /home/my_user/Webdev/Templates/
>
> Should i create another polls dir under templates
> (/home/my_user/Webdev/Templates/polls/polls) considering in the error
> message i get 'polls/poll_list.html' , besides 'index.html'? This seems
> redundant and i'd like to understand why i would have to.
>
> Thanks again for your help.
>
> On Thursday, July 19, 2012 12:08:39 AM UTC+1, Ricardo Cardoso wrote:
>>
>> I'm new to django and python, and decided to follow up the available
>> tutorials to get up to speed. These were helpful and got me on my feet but
>> while finishing up the tutorial i hit a major snag. While everything was
>> working properly using custom views, i can't seem to make my app load the
>> correct templates after switching to generic views.
>>
>> Here's the code:
>>
>> #urls.py
>> from django.conf.urls import patterns, include, url
>> from django.views.generic import DetailView, ListView
>> from polls.models import Poll
>>
>> urlpatterns = patterns('',
>> url(r'^$',
>> ListView.as_view(
>> queryset=Poll.objects.order_by('-pub_date')[:5],
>> context_object_name='latest_poll_list',
>> template_name='polls/index.html')),
>> url(r'^(?P<pk>\d+)/$',
>> DetailView.as_view(
>> model=Poll,
>> template_name='polls/detail.html')),
>> url(r'^(?P<pk>\d+)/results/$',
>> DetailView.as_view(
>> model=Poll,
>> template_name='polls/results.html'),
>> name='poll_results'),
>> url(r'^(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),
>> )
>>
>> The way i decided (perhaps wrongly) to organize my apps and templates is
>> as follows:
>>
>> Template dir as defined in settings.py:
>> TEMPLATE_DIRS = ('/home/my_user/Webdev/Templates/', # this is where i'm
>> storing my templates at the moment
>>
>> App location: /home/my_user/Webdev/Django-lessons/pollproject/polls
>>
>> If i try to access the polls app directly by using the URL:
>> http://127.0.0.1:8000/polls/ i now get an error message stating that:
>>
>> TemplateDoesNotExist at /polls/
>>
>> index.html, polls/poll_list.html
>>
>>
>>
>> I realize this might have something to do with where i decided to store
>> my templates (made more sense at the time to store them separately since i
>> thought i could use different templates for the same app, for different
>> purposes).
>>
>> This is probably a basic issue but any help regarding this would be
>> greatly appreciated.
>>
>> Thanks!
>>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/Xn2AVhifd2MJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.