Hi,

You need to set the template directories option in your project's settings 
file.

See here:
https://docs.djangoproject.com/en/1.11/topics/templates/#configuration

There's an example in the above link:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            '/home/html/example.com',
            '/home/html/default',
        ],
    },
    {
        'BACKEND': 'django.template.backends.jinja2.Jinja2',
        'DIRS': [
            '/home/html/jinja2',
        ],
    },
]


Once Django is aware of where to search for templates, you can include 
templates from your project's templates directory as follows:
{% include "Error.html" %}

And you can include app templates as follows:
{% include "App1/App1.html" %}



Also, pay attention to capitalization of filenames, as "Error.html" and 
"error.html" are different files on many systems. I use all-lowercase to 
avoid issues.

Dartos

On Wednesday, May 3, 2017 at 10:00:37 AM UTC-4, Thiago Luiz Parolin wrote:
>
> I have a project that has a folder structure like this:
>
> Project1 /
> ------Templates /
> ------------Base.html
> ------------Error.html
> ------App1
> ------------Templates /
> ------------------App1 /
> ------------------------App1.html
>
> How can i include error.html in app1.html?
>
> I am trying using {% include "../../../templates/error.html"%} but get 
> error on page rendering:
>
> The relative path '"../../../templates/error.html"' points outside the 
> file hierarchy that template 'app1 / app1.html' is in.
>
>
> I am totally new to django, python and programming.
> Any help will be appreciated.
>

On Wednesday, May 3, 2017 at 10:00:37 AM UTC-4, Thiago Luiz Parolin wrote:
>
> I have a project that has a folder structure like this:
>
> Project1 /
> ------Templates /
> ------------Base.html
> ------------Error.html
> ------App1
> ------------Templates /
> ------------------App1 /
> ------------------------App1.html
>
> How can i include error.html in app1.html?
>
> I am trying using {% include "../../../templates/error.html"%} but get 
> error on page rendering:
>
> The relative path '"../../../templates/error.html"' points outside the 
> file hierarchy that template 'app1 / app1.html' is in.
>
>
> I am totally new to django, python and programming.
> Any help will be appreciated.
>

On Wednesday, May 3, 2017 at 10:00:37 AM UTC-4, Thiago Luiz Parolin wrote:
>
> I have a project that has a folder structure like this:
>
> Project1 /
> ------Templates /
> ------------Base.html
> ------------Error.html
> ------App1
> ------------Templates /
> ------------------App1 /
> ------------------------App1.html
>
> How can i include error.html in app1.html?
>
> I am trying using {% include "../../../templates/error.html"%} but get 
> error on page rendering:
>
> The relative path '"../../../templates/error.html"' points outside the 
> file hierarchy that template 'app1 / app1.html' is in.
>
>
> I am totally new to django, python and programming.
> Any help will be appreciated.
>

On Wednesday, May 3, 2017 at 10:00:37 AM UTC-4, Thiago Luiz Parolin wrote:
>
> I have a project that has a folder structure like this:
>
> Project1 /
> ------Templates /
> ------------Base.html
> ------------Error.html
> ------App1
> ------------Templates /
> ------------------App1 /
> ------------------------App1.html
>
> How can i include error.html in app1.html?
>
> I am trying using {% include "../../../templates/error.html"%} but get 
> error on page rendering:
>
> The relative path '"../../../templates/error.html"' points outside the 
> file hierarchy that template 'app1 / app1.html' is in.
>
>
> I am totally new to django, python and programming.
> Any help will be appreciated.
>

On Wednesday, May 3, 2017 at 10:00:37 AM UTC-4, Thiago Luiz Parolin wrote:
>
> I have a project that has a folder structure like this:
>
> Project1 /
> ------Templates /
> ------------Base.html
> ------------Error.html
> ------App1
> ------------Templates /
> ------------------App1 /
> ------------------------App1.html
>
> How can i include error.html in app1.html?
>
> I am trying using {% include "../../../templates/error.html"%} but get 
> error on page rendering:
>
> The relative path '"../../../templates/error.html"' points outside the 
> file hierarchy that template 'app1 / app1.html' is in.
>
>
> I am totally new to django, python and programming.
> Any help will be appreciated.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a61f65d2-5506-4750-a0c6-eb1be9663211%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to