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

  • Home
  • SEARCH
  • 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 503033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:21:10+00:00 2026-05-13T06:21:10+00:00

My local machine is running Python 2.5 and Nginx on Ubuntu 8.10, with Django

  • 0

My local machine is running Python 2.5 and Nginx on Ubuntu 8.10, with Django builded from latest development trunk.

For every URL I request, it throws:

TemplateDoesNotExist at /appname/path appname/template_name.html

Django tried loading these templates, in this order:
* Using loader django.template.loaders.filesystem.function:
* Using loader django.template.loaders.app_directories.function:

TEMPLATE_DIRS
(‘/usr/lib/python2.5/site-packages/projectname/templates’,)

Is it looking for /usr/lib/python2.5/site-packages/projectname/templates/appname/template_name.html in this case? The weird thing is this file does existed on disk. Why can’t Django locate it?

I run the same application on a remote server with Python 2.6 on Ubuntu 9.04 without such problem. Other settings are the same.

Is there anything misconfigured on my local machine, or what could possibly have caused such errors that I should look into?

In my settings.py, I have specified:

SETTINGS_PATH = os.path.normpath(os.path.dirname(__file__))
# Find templates in the same folder as settings.py.
TEMPLATE_DIRS = (
    os.path.join(SETTINGS_PATH, 'templates'),
)

It should be looking for the following files:

  • /usr/lib/python2.5/site-packages/projectname/templates/appname1/template1.html
  • /usr/lib/python2.5/site-packages/projectname/templates/appname1/template2.html
  • /usr/lib/python2.5/site-packages/projectname/templates/appname2/template3.html
  • …

All the above files exist on disk.

Solved

It works now after I tried:

chown -R www-data:www-data /usr/lib/python2.5/site-packages/projectname/*

It’s strange. I don’t need to do this on the remote server to make it work.

  • 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-13T06:21:10+00:00Added an answer on May 13, 2026 at 6:21 am

    First solution:

    These settings

    TEMPLATE_DIRS = (
        os.path.join(SETTINGS_PATH, 'templates'),
    )
    

    mean that Django will look at the templates from templates/ directory under your project.

    Assuming your Django project is located at /usr/lib/python2.5/site-packages/projectname/ then with your settings django will look for the templates under /usr/lib/python2.5/site-packages/projectname/templates/

    So in that case we want to move our templates to be structured like this:

    /usr/lib/python2.5/site-packages/projectname/templates/template1.html
    /usr/lib/python2.5/site-packages/projectname/templates/template2.html
    /usr/lib/python2.5/site-packages/projectname/templates/template3.html
    

    Second solution:

    If that still doesn’t work and assuming that you have the apps configured in settings.py like this:

    INSTALLED_APPS = (
        'appname1',
        'appname2',
        'appname3',
    )
    

    By default Django will load the templates under templates/ directory under every installed apps. So with your directory structure, we want to move our templates to be like this:

    /usr/lib/python2.5/site-packages/projectname/appname1/templates/template1.html
    /usr/lib/python2.5/site-packages/projectname/appname2/templates/template2.html
    /usr/lib/python2.5/site-packages/projectname/appname3/templates/template3.html
    

    SETTINGS_PATH may not be defined by default. In which case, you will want to define it (in settings.py):

    import os
    SETTINGS_PATH = os.path.dirname(os.path.dirname(__file__))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.