PerryDaPlatypus PerryDaPlatypus - 1 year ago 89
Python Question

Do the Templates in django need to move to public while using Passenger

Very familiar with python and Flask, but just getting started with Django.


Dreamhost, Django 1.9 (i think), python 2.7.3, Passenger


I have my app working and can generate an index page using HttpResponse straight from However, when I try to incorporate templates, I am getting "TemplateDoesNotExist at /"

Because I'm new, I'm not sure where to start troubleshooting. Is this a passenger issue or Django?


I've modified my [DIRS] in to reference the templates directory.

'DIRS': ['CTracker/templates'],

I then created the templates directory under CTracker and the 'clientadmin' (the name of my app) directory and finally the index.html file.

| |
| -templates
| |
| -clientadmin
| |
| -index.html

My function in uses the following return.

return render(request, 'clientadmin/index.html', {
'clients': client,

Troubleshooting Done

  • Double checked the files exist and the path to the file appears
    correct in both the filesystem and the file.

  • I tried running ' collectstatics' but 0 files were moved.

Thank you in advance. Any help is appreciated.

Answer Source

The items in the DIRS list should be the full path, for example:

'DIRS': ['/path/to/CTracker/CTracker/templates'],

The Django settings file should have a BASE_DIR defined. You can use this with os.path.join to avoid hardcoding the full path.

'DIRS': [os.path.join(BASE_DIR, 'CTracker', 'templates')]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download