python - Django template doesn't render properly, just prints "{ % extends base % }" etc to the page -


i'm trying basic django template working on google app engine app (on local machine, not yet deployed, if matters), app acting has no idea how templates work. prints { % extends "base.html" %} webpage instead of using load template so:

enter image description here

although, views seem working otherwise, since "{{ message }}" @ least loads correct thing. feel i'm missing silly piece of information, i'm @ loss. i've been looking @ django documentation while , have no idea went wrong. here relevant code:

snippet of settings.py:

template_dirs = ( os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'hello/templates')) # put strings here, "/home/html/django_templates" or "c:/www/django/templates". # use forward slashes, on windows. # don't forget use absolute paths, not relative paths. ) 

in views.py:

from django import http django.shortcuts import render_to_response  def home(request):     return render_to_response('index.html', {'message':'hello world!'})  def form(request):     return render_to_response('index.html', {'message':'this page have form.'}) 

in base.html (which in correct template_dirs path):

<head>     <title>lunar spring</title>     <meta charset="utf-8"> </head> <body>      <div class="header">     website name     </div>     <div class="content">     { % block content %}     { % endblock % }     </div>  </body> 

in index.html (also in correct path):

{ % extends "base.html" % }  { % block content % }     {{ message }} { % endblock % } 

your django template syntax not correct, watch spaces between curly braces , percent sign.

for example, replace:

{ % extends "base.html" % } 

with:

{% extends "base.html" %} 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -