Error in including template

471 views
Skip to first unread message

RHH

unread,
Jul 29, 2021, 7:20:47 PM7/29/21
to oTree help & discussion
Hi,

I haven't used oTree for a while and it seems to have been updated a lot.  I started to test my old code from last Sep and it can't load pages with included templates. I got error msg as below:

otree.templating.errors.TemplateRenderingError: Error while rendering the PRINT tag: RecursionError: maximum recursion depth exceeded in comparison (line 11, in "fld")

During handling of the above exception, another exception occurred:

otree.templating.errors.TemplateLoadError: Loader cannot locate the template file 'UNIDENTIFIED'.

Does anyone know what is going on here?

Thanks,
RH

RHH

unread,
Jul 29, 2021, 7:21:29 PM7/29/21
to oTree help & discussion
Also in the web page it says "Internal Server Error"

Chris @ oTree

unread,
Jul 29, 2021, 7:37:21 PM7/29/21
to oTree help & discussion
(0) run 'otree update_my_code' and fix any messages
(1) update otree to the latest version
(2) please show your code, including the includable template that causes the error

RHH

unread,
Jul 30, 2021, 2:18:54 PM7/30/21
to oTree help & discussion

Hi Chris,

Thanks. I run otree update_my_code and it says "Done. all files checked." My otree version should be the latest (5.2.8), though I am still using self format.

The code including the template is shown below. Note that the page works fine if not including the template so other code shouldn't matter. (SF_AutoS is the project name)

{% include "SF_AutoS/Instructions_AutoS.html" %}

In Instructions_AutoS.html I only have the following:

{% extends "global/Page.html" %}
{% load otree static %}

{% block content %}
<div class="card bg-light">
<div class="card-body">

<h3>
Instructions
</h3>
<p>
These are the instructions for the game....
</p>
</div>
</div>

{% endblock %}

Chris @ oTree

unread,
Jul 30, 2021, 3:22:49 PM7/30/21
to RHH, oTree help & discussion
Includable templates should not have an “extends”. 

Sent from my phone

On Jul 30, 2021, at 12:19 PM, RHH <huang...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/a0df8e1c-e9c9-4c9d-8650-5e4221361502n%40googlegroups.com.

Chris @ oTree

unread,
Jul 30, 2021, 3:31:26 PM7/30/21
to RHH, oTree help & discussion
Think of includable templates as content that gets inserted directly into the main template. So if you are already in a content block, your includable template should not have another content block because that would be redundant. 

Sent from my phone

On Jul 30, 2021, at 1:22 PM, ch...@otree.org wrote:

Includable templates should not have an “extends”. 

RHH

unread,
Jul 30, 2021, 5:36:51 PM7/30/21
to oTree help & discussion
Hi Chirs,

Thanks for the answer. Do you know what I should put there instead of "extends" if I want to apply all CSS setting I put in the global Page.html? 

Thanks,
RH

RHH

unread,
Jul 30, 2021, 5:57:33 PM7/30/21
to oTree help & discussion
After I delete the "extend" code, the page loads normally but the included content is missing.
Reply all
Reply to author
Forward
0 new messages