Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 829249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:51:08+00:00 2026-05-15T03:51:08+00:00

I’m getting a strange error that only occurs on the live server. My Django

  • 0

I’m getting a strange error that only occurs on the live server. My Django templates directory is set up like so

  • base.html
  • two-column-base.html
  • portfolio
    • index.html
  • extranet
    • base.html
    • index.html

The portfolio pages work correctly locally on multiple machines. They inherit from either the root base.html or two-column-base.html. However, now that I’ve posted them to the live box (local machines are Windows, live is Linux), I get a TemplateSyntaxError: “Caught TemplateDoesNotExist while rendering: base.html” when I try to load any portfolio pages. It seems to be a case where the extends tag won’t work in that root directory (???). Even if I do a direct_to_template on two-column-base.html (which extends base.html), I get that error. The extranet pages all work perfectly, but those templates all live inside the /extranet folder and inherit from /extranet/base.html.

Possible issues I’ve checked:

  • file permissions on the server are fine
  • the template directory is correct on the live box (I’m using os.path.dirname(os.path.realpath(__file__)) to make things work across machines)
  • files exist and the /templates directories exactly match my local copy
  • removing the {% extends %} block from the top of any broken template causes the templates to render without a problem
  • manually starting a shell session and calling get_template on any of the files works, but trying to render it blows up with the same exception on any of the extended templates. Doing the same with base.html, it renders perfectly (base.html also renders via direct_to_template)

Django 1.2, Python 2.6 on Webfaction. Apologies in advance because this is my 3rd or 4th “I’m doing something stupid” question in a row. The only x-factor I can think of is this is my first time using Mercurial instead ofsvn. Not sure how I could have messed things up via that.

EDIT: One possible source of problems: local machine is Python 2.5, live is 2.6.

Here’s a traceback of me trying to render ‘two-column-base.html’, which extends ‘base.html’. Both files are in the same directory, so if it can find the first, it can find the second. c is just an empty Context object.

>>> render_to_string('two-column-base.html', c)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/projectname/webapps/django/lib/python2.6/django/template/loader.py", line 186, in render_to_string
    return t.render(context_instance)
  File "/home/projectname/webapps/django/lib/python2.6/django/template/__init__.py", line 173, in render
    return self._render(context)
  File "/home/projectname/webapps/django/lib/python2.6/django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)
  File "/home/projectname/webapps/django/lib/python2.6/django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))
  File "/home/projectname/webapps/django/lib/python2.6/django/template/debug.py", line 72, in render_node
    result = node.render(context)
  File "/home/projectname/webapps/django/lib/python2.6/django/template/loader_tags.py", line 103, in render
    compiled_parent = self.get_parent(context)
  File "/home/projectname/webapps/django/lib/python2.6/django/template/loader_tags.py", line 100, in get_parent
    return get_template(parent)
  File "/home/projectname/webapps/django/lib/python2.6/django/template/loader.py", line 157, in get_template
    template, origin = find_template(template_name)
  File "/home/projectname/webapps/django/lib/python2.6/django/template/loader.py", line 138, in find_template
    raise TemplateDoesNotExist(name)
TemplateSyntaxError: Caught TemplateDoesNotExist while rendering: base.html

I’m wondering if this is somehow related to the template caching that was just added to Django.

EDIT 2 (per lazerscience):

template-related settings:

import os
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
TEMPLATE_DIRS = (
    os.path.join(PROJECT_ROOT, 'templates'),
)

sample view:

def project_list(request, jobs, extra_context={}):
    context = {
        'jobs': jobs,
    }
    print context
    context.update(extra_context)

    return render_to_response('portfolio/index.html', context, context_instance=RequestContext(request))

EDIT: deleted dead links

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:51:09+00:00Added an answer on May 15, 2026 at 3:51 am

    ARGH: I should have posted the extends a long time ago. For posterity’s sake and anyone else as dumb as me who manages to remember to breathe and figure out Google, here’s the offender that works in Windows but not Linux.

    {% extends “two-column-base.html “%}

    instead of

    {% extends “two-column-base.html” %}

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.