here is my site url http://webtrick.heliohost.org/ my template directory settings:
TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__) , 'templates').replace('\\','/') )
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')
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
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? {{ name }} will be the output. It will be displayed as name in HTML. The name will be replaced with values of Python variable.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With