I did as you said. Still its giving the same error :(
On Dec 2, 11:38 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-12-01 at 22:20 -0800, Vicky wrote: > > I tried the code below: > > > from django.template import loader, Context > > > def NewspaperSelect(request,u_id): > > t=loader.get_template(r'C:\django\noddler\news\template.vxml') > > c=Context({ 'topic':'news', 'content':pn }) > > return HttpResponse(t.render(c), mimetype='application/xml') > > > I verified that the file is in the location. But when i compile it > > keeps telling that template file does not exist. What to do? > > get_template() doesn't take a full path to a file. It takes the name of > a template, possibly with some directories in front -- but it's a > relative path. What the path is relative to depends on the template > loader being used. Unless you've done anything special to your setup, > Django will try the application loader first -- appending the path to > <app_name>/templates/ for each app_name that you have installed. Then it > will try the filesystem loader, which will append the path to each > diretcory in the TEMPLATE_DIRS setting and see if it exists. > > So you either need to set up TEMPLATE_DIRS or put the templates in a > templates/ directory inside one (or more) of your applications. > > This ends up making the code very portable, by the way, since when you > install it somewhere else, you only have to change the TEMPLATE_DIRS > settings (at most) and all your templates will still 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 -~----------~----~----~----~------~----~------~--~---