I tried this using the development server on my local machine and got
the same result:

Template-loader postmortem

Django tried loading these templates, in this order:

    * Using loader
django.template.loaders.filesystem.load_template_source:
          o /django_projects/django_templates/polls/index.html (File
does not exist)
    * Using loader
django.template.loaders.app_directories.load_template_source:
          o /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/contrib/admin/templates/polls/
index.html (File does not exist)

# SETTINGS.PY
TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    '/django_projects/django_templates',
)

# URLS.PY
from django.conf.urls.defaults import *

urlpatterns = patterns('',
    # Example:
    (r'^polls/$', 'mysite.polls.views.index'),
    (r'^polls/(?P<poll_id>\d+)/$', 'mysite.polls.views.detail'),
    (r'^polls/(?P<poll_id>\d+)/results/$',
'mysite.polls.views.results'),
    (r'^polls/(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),


    # Uncomment this for admin:
    (r'^admin/', include('django.contrib.admin.urls')),
)

# VIEWS.PY
from django.template import Context, loader
from mysite.polls.models import Poll
from django.http import HttpResponse

def index(request):
    latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
    t = loader.get_template('polls/index.html')
    c = Context({
        'latest_poll_list': latest_poll_list,
    })
    return HttpResponse(t.render(c))


I also tried another template and got the same error.


On Nov 11, 8:49 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-11-11 at 20:05 -0800, [EMAIL PROTECTED] wrote:
> > Hello,
>
> > I'm getting this error and the missing template IS in the template
> > directory defined in settings.py and views.py
>
> Everything looks correct visually, with one exception:
>
>
>
> > # SETTINGS.PY
> > TEMPLATE_DIRS = (
> >     # Put strings here, like "/home/html/django_templates" or "C:/www/
> > django/templates".
> >     # Always use forward slashes, even on Windows.
> >     # Don't forget to use absolute paths, not relative paths.
> >    '/home/projects/django_templates/SITENAME'
>
> If this is the only entry in TEMPLATE_DIRS, you will need to put a
> trailing comma there, since ("some_string") is not a tuple in Python and
> ("some_string",) is. That's a common error.
>
> You don't say how you're testing this. Does it only fail with a
> webserver like Apache (and works with the development server)? In that
> case, I'd suspect directory permissions.
>
> If it also fails with the development server, do other templates from
> the SITENAME/polls/ directory load correctly?
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to