[Answered ]-TemplateDoesNotExist at / base/index.html when deploying to heroku

2👍

In your TEMPLATES setting, try changing your DIRS setting to:

'DIRS': [os.path.join(BASE_DIR, 'templates')],

This is the usual approach, I cannot see any reason to use MAIN_DIR as you currently do.

Keep the template as

template_name = "base/index.html"

0👍

I had this issue because I was using camelcase in my HTML template name but calling it with small cases. Changed template name to small case and it worked.

👤Ulvi

0👍

I also had this problem. The problem was I had:

'DIRS': [os.path.join(BASE_DIR, 'templates')],

in my settings.py instead of:

'DIRS': [os.path.join(BASE_DIR, 'Templates')],

The templates directory had a capital T, but I typed it with a lowercase t in settings.py.

0👍

makes sure your template directory is named ‘templates’ not ‘Templates’

0👍

I had similar problem with space at end of file names – e.g. in a template

{% include 'myapp/components/breadcrumb.html ' %}
                               # SPACE HERE ^

Works just fine when developing on Windows <sigh>, fails on Linux.

👤Ryan

Leave a comment