Please provide path to your templates 2012/7/19 Ricardo Cardoso <morgo...@gmail.com>: > 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/-/gWDhmGFeSlEJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en.
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.