TemplateDoesNotExist Error...

43 views
Skip to first unread message

rmschne

unread,
Nov 19, 2012, 9:12:56 PM11/19/12
to django...@googlegroups.com

I have moved to a new laptop which is both my development and production platform. The only change in infrastructure is that I run Python, Django, and all else in a virtual environment (VirtualEnv).  

I am not using Django to run on a web server.  

I have a function which produces a set of HTML files.  The first calls

t=get_template('soc_ad_host_and_guest_list.html')  
txt=smart_str(t.render(Context({ ... more stuff })))

and the above works fine.

On the second call to a different template which a) does exist, and b) is in the template folder defined by TEMPLATE_DIRS,

 t=get_template('soc_ad_table_guest_list_for_prog.html')
 txt=smart_str(t.render(Context({'host_list': hostlist,})))and at the statement txt= I get the Django Error: TemplateDoesNotExist

Since I'm not on a web server I can't see the so-called "post mortem" message.  But the template files 'soc_ad_table_guest_list_for_prog.html' does indeed exist, its permissions are 770 (same as the first template that does work).

Suggestions? Any more debugging I can turn on?

rmschne

unread,
Nov 20, 2012, 4:27:50 AM11/20/12
to django...@googlegroups.com
Yes, with guidance from Django/Python, I am sure the error occurs there. Django/Pythyon presents the trace and the line number which causes the exception is reported to the command Line.  However, I will look again at that line and all lines above.

Yes, I know there is a "good" chance as the clue is that is what the error message says. However, the fact is the file does exist. I've used copy/paste to test using "ls" the existence of both the Template folder and the file.  "ls" can find it. OSX's Finder can find it.  It's there.

If I comment out this part of the code, the next section which works on another template located in the same folder also fails.  Oddly, the first set of commands working on a template in the same folder works.  It's just the "next" one.

As mentioned, a web server is not involved, so not sure how to use the LOGGING variable.  I will look again.

Reply all
Reply to author
Forward
0 new messages