Forums

Included templates are not found by django

Hello, I am facing a problem using the Django tag {% include %} in templates.

When I load a template using the render function in a view, everything works fine, the template is retrieved, so as the static files.

But when I want to include a template inside another, both from the same directory, thank's to the {% include %} tag, Django keeps returning me this error: TemplateDoesNotExist.

The include tag used:

{% include 'app_Map/ElementsData.html '%}
{% include 'app_Map/Generic_data.html '%}

The template loader post-mortem indicates that Django is searching for the following files in my applications' folders:

Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.filesystem.Loader: /home/BanneProject/BanneProject/templates/app_Map/ElementsData.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python3.8/site-packages/django/contrib/admin/templates/app_Map/ElementsData.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/lib/python3.8/site-
packages/django/contrib/auth/templates/app_Map/ElementsData.html (Source does not exist)
django.template.loaders.app_directories.Loader: /home/BanneProject/BanneProject/app_Map/templates/app_Map/ElementsData.html (Source does not exist)
django.template.loaders.app_directories.Loader: /home/BanneProject/BanneProject/app_Home/templates/app_Map/ElementsData.html (Source does not exist)
django.template.loaders.app_directories.Loader: /home/BanneProject/BanneProject/app_List/templates/app_Map/ElementsData.html (Source does not exist)
django.template.loaders.app_directories.Loader: /home/BanneProject/BanneProject/app_Edit/templates/app_Map/ElementsData.html (Source does not exist)

I've triple checked, the templates are in the folders, case included. I don't know how to get the include tag to work on python anywhere. This issue were not seen on local development.

Thank's in advance!

EDIT: Solution found! It was just the spaces in the include tag that were inside the quotes.

Can I take a look at your files? We can see them from our admin interface, but we always ask for permission first.