Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (19.9k points)

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.

1 Answer

0 votes
by (25.1k points)

The issue seems to be with file ownership in linux system.

Try running the following command:

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

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Mar 8, 2021 in Web Technology by Rekha (2.2k points)
0 votes
1 answer
asked Mar 8, 2021 in Web Technology by Rekha (2.2k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...