Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TemplateDoesNotExist at/

Tags:

here is my site url http://webtrick.heliohost.org/ my template directory settings:

TEMPLATE_DIRS = (     os.path.join(os.path.dirname(__file__) , 'templates').replace('\\','/') ) 

view.py

from django.http import HttpResponse from django.template import Template , Context from django.shortcuts import render_to_response def index(request):         return render_to_response('index.html') 

url.py

from django.conf.urls.defaults import patterns, include, url from webtrickster.views import index urlpatterns = patterns('',     url(r'^$', index) ) 

i don't know what's wrong with this code any help appreciated

like image 656
Crazy Chuck Avatar asked Apr 16 '11 11:04

Crazy Chuck


People also ask

How do I fix Django TemplateDoesNotExist error?

Django TemplateDoesNotExist error means simply that the framework can't find the template file. To use the template-loading API, you'll need to tell the framework where you store your templates. The place to do this is in your settings file ( settings.py ) by TEMPLATE_DIRS setting.

What does {{ NAME }} this mean in Django templates?

What does {{ name }} this mean in Django Templates? {{ name }} will be the output. It will be displayed as name in HTML. The name will be replaced with values of Python variable.

What is Django template language?

A Django template is a text document or a Python string marked-up using the Django template language. Some constructs are recognized and interpreted by the template engine. The main ones are variables and tags. A template is rendered with a context.


1 Answers

Make sure your Django app is in the INSTALLED_APPS in settings.py. That was my problem with it. So if you have the templates folder in your polls app folder, you need to add the 'polls' at the end of the installed apps in the settings file.

like image 151
pkout Avatar answered Oct 31 '22 16:10

pkout