<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7">
</head>
<body fpstyle="1" ocsi="0" bgcolor="#FFFFFF">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi George,<br>
<br>
thank you for your answer. I was following a tutorial and I didn't notice that there was already an empty site_base template under Geonode directories (geonode/geonode/templates/site_base.html). This file is visible by all custom apps, hence it works as a starting
 point to customize the look of the pages, as you poited out.<br>
My question was different, though: I'd like to extend template across apps, so if we go back to the example directory tree, let's say that I want to extend app1_base.html from app2_base.html.
<br>
As far as I know, enabling both APP_DIRS or specific loaders from setting.py should do the job; the problem is that if I try to do that, I cannot extend templates from GeoNode directory anymore because they're not found.
<br>
<br>
LOCAL_ROOT = os.path.abspath(os.path.dirname(__file__))<br>
TEMPLATES = [<br>
    {<br>
        'BACKEND': 'django.template.backends.django.DjangoTemplates',<br>
        'DIRS': [os.path.join(LOCAL_ROOT, 'templates')],<br>
        'APP_DIRS': True,<br>
        'OPTIONS': {<br>
           'context_processors': [<br>
               "django.contrib.auth.context_processors.auth",<br>
           ],<br>
        }        <br>
   },<br>
]<br>
<br>
If I edit the DIRS in TEMPLATE settings, explicitly adding the GeoNode template path (../../geonode/geonode/templates), I start getting other errors, like the following:<br>
<br>
<b>KeyError</b> : from geonode/geonode/templates/_announcements.html ( {% announcements as site_wide_announcements %} )<br>
<br>
Can you help me understanding what I'm doing wrong?<br>
<br>
Best regards,<br>
Stefano<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF299356" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> gkpetrak [gkpetrak@gmail.com]<br>
<b>Sent:</b> 14 November 2017 15:49<br>
<b>To:</b> LUONI Stefano (JRC-ISPRA-EXT); geonode-users@lists.osgeo.org<br>
<b>Subject:</b> Re: [GeoNode-users] Template extension over multiple apps<br>
</font><br>
</div>
<div></div>
<div>
<p>Hello Stefano,</p>
<p><br>
</p>
<p>You don't have to name site_base.html or index.html the base templates of your apps. You should name them in a way like: app1_base.html. So your directory tree will look like this:</p>
<p><font size="2"><font face="Arial">-virtual_environment<br>
-geonode<br>
    -geonode<br>
        -templates<br>
            -base.html<br>
            -index.html<br>
-custom_project<br>
    -app1<br>
        -templates<br>
            -app1_base.html (extends site_base.html which extends base.html)<br>
            -app1_index.html (if It's required)(extends site_index.html which extends index.html)<br>
    -app2<br>
        -templates<br>
            </font></font><font size="2"><font face="Arial">-app2_base.html (extends site_base.html which extends base.html)<br>
            -app2_index.html </font></font><font size="2"><font face="Arial"><font size="2"><font face="Arial"> (if It's required)</font></font> (extends site_index.html which extends index.html)</font></font></p>
<p><font size="2"><font face="Arial"><br>
</font></font></p>
<p><font size="2"><font face="Arial">As GeoNode is composed of many apps see for example the directory structure of "layers" app</font></font></p>
<p><font size="2"><font face="Arial"><br>
</font></font></p>
<p><font size="2"><font face="Arial">site_base.html and index_base.html is the  base template of your GeoNode project in order to customize your site.</font></font></p>
<p><font size="2"><font face="Arial"><br>
</font></font></p>
<p><font size="2"><font face="Arial">Best Regards,</font></font></p>
<p><font size="2"><font face="Arial">George<br>
</font></font></p>
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 14/11/2017 02:48 μμ, <a class="moz-txt-link-abbreviated" href="mailto:Stefano.LUONI@ext.ec.europa.eu" target="_blank">
Stefano.LUONI@ext.ec.europa.eu</a> wrote:<br>
</div>
<blockquote type="cite"><style type="text/css" id="owaParaStyle">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
BODY {direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;}P {margin-top:0;margin-bottom:0;}BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}</style>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt"><font size="2"><font face="Arial">Hi everyone,
<br>
<br>
I know that it sounds more of a Django related question, but as a non Django expert I'm a bit confused about the ways to extend templates.<br>
<br>
<u>The problem</u><br>
In a development environment, suppose we have created a new app and suppose we call it
<b>app1</b>; we can customise the page look by editing <b>site_base.html </b>for global parts,
<b>index.html </b>or other specific templates, knowing that site_base will extend
<b>base.html </b>from geonode/templates folder, and so on.<br>
What if we create another custom app and we call it <b>app2</b>: how can we define templates that could inherit from what was already defined by
<b>app1</b>?<br>
<br>
The directory tree looks like this:<br>
<br>
-virtual_environment<br>
-geonode<br>
    -geonode<br>
        -templates<br>
            -base.html<br>
            -index.html<br>
-custom_project<br>
    -app1<br>
        -templates<br>
            -site_base.html (extends base.html)<br>
            -site_index.html (extends index.html)<br>
    -app2<br>
        -templates<br>
            -new_template => how to extend site_base.html?<br>
<br>
The issue I'm facing is that as soon as I enable context_processors in my settings.py, I get an error because the Geonode base.html template is not found (from extends base.html in geonode/base/templates/geonode_base.html).<br>
I tried using different configurations with loaders like app_namespace or apptemplates with no luck.<br>
<br>
Do you have any suggestions for solving this?<br>
<br>
Thanks,<br>
<br>
Stefano<br>
<br>
            <br>
        <br>
    <br>
</font></font></div>
<br>
<fieldset class="mimeAttachmentHeader" target="_blank"></fieldset> <br>
<pre>_______________________________________________
geonode-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:geonode-users@lists.osgeo.org" target="_blank">geonode-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/geonode-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/geonode-users</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</body>
</html>