Note that there are some explanatory texts on larger screens.

plurals
  1. POIs Django lying to me?! render_to_response function returns TemplateDoesNotExist when the file does indeed exist
    primarykey
    data
    text
    <p>OK. I have read many other accounts of this happening, and they were always solved when the question asker correctly modified their TEMPLATE_DIRS setting. None of these suggestions have worked for me. The strange thing is that the template loads when using the Django web server, but errors out when using mod_wsgi. I think django is maybe throwing an incorrect exception, because the TemplateDoesNotExist error simply can not apply given my settings.</p> <p>My code:</p> <p>my app/views/view.py (yes, i have my views in a subfolder)</p> <pre><code> 8 def index(request): 9 return render_to_response('pages/home/base_home.html') </code></pre> <p>Here is my settings.py located at root (standard location)</p> <pre><code>106 TEMPLATE_DIRS = ( 107 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". 108 # Always use forward slashes, even on Windows. 109 # Don't forget to use absolute paths, not relative paths. 110 "/home/foobar/templates", 111 ) </code></pre> <p>And finally, here is my view located at /home/foobar/templates/pages/home/</p> <pre><code> 1 {% extends 'base.html' %} 2 3 {% block navigation %} 4 {% include 'modules/navigation/navigation.html' %} 5 {% endblock %} 6 7 {% block slideshow %} 8 {% include 'modules/slideshow/slideshow.html' %} 9 {% endblock %} </code></pre> <p>Also, here is an ls -l proving that the file does exist</p> <pre><code>foo@bar:~$ ls -l templates/pages/home/ total 12 -rwxr-xr-x 1 foo foo 205 2011-06-05 12:37 base_home.html foo@bar:~$ </code></pre> <p>Here is the postmortem report that Django gives me:</p> <pre><code>Template-loader postmortem Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: /home/foobar/templates/pages/home/base_home.html (File does not exist) Using loader django.template.loaders.app_directories.Loader: /usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/pages/home/base_home.html (File does not exist) </code></pre> <p><em>edit</em></p> <p>Here is my wsgi file</p> <pre><code> 3 import os 4 import sys 5 6 path = '/media/PENDRIVE/Projects/' 7 if path not in sys.path: 8 sys.path.append(path) 9 10 os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' 11 12 import django.core.handlers.wsgi 13 application = django.core.handlers.wsgi.WSGIHandler() 14 </code></pre> <p>Thank you for any insight, as I am baffled and stuck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload