WebFaction
Community site: login faq

So I was playing around with template scripting. I made a new plate that had the line:

{% include 'parts/google_analytics.html' %}

I got an error: "Could not parse the remainder: '% include 'parts/google_analytics.html' %' from '% include 'parts/google_analytics.html' %'"

Ok, not a big deal, Django's include can't handle subdirectories. So I change it and move the file accordingly:

{% include 'google_analytics.html' %}

But I still get the SAME error I got before error: "Could not parse the remainder: '% include 'parts/google_analytics.html' %' from '% include 'parts/google_analytics.html' %'"

At first I thought maybe Django hadn't gotten the template but when it shows the highlighted line which it believes contains the error it displays the correct code:

{% include 'google_analytics.html' %}

So it appears Django has cached the error is some way? And I don't know how to fix it! I've tried:

  • renaming the template and changing it's name in views.py
  • restarting Apache.
  • clearing all the .pyc files from the app and the project file and restarting Apache.

But none of these have worked :/

asked 30 Jan '13, 17:41

codeape
11
accept rate: 0%


Django's template system can deal with sub-directories. Are you editing the template with a text editor which saves the file in Unix or DOS format? The nature of the error, to me seems to be an encoding error, since it is failing after a space. Try running the dos2unix binary on the template file,

dos2unix /path/to/template.html
permanent link

answered 30 Jan '13, 17:51

johns
5.4k412
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×910
×108
×28
×13
×2

question asked: 30 Jan '13, 17:41

question was seen: 2,210 times

last updated: 30 Jan '13, 17:51

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM