Application error (500) TemplateLoadError: Loader cannot locate the template file "./X.html"l

566 views
Skip to first unread message

Yan Yi Fong

unread,
Apr 17, 2021, 4:04:29 PM4/17/21
to oTree help & discussion
Hello,
I'm trying to use an includable template and I get this error when trying to run it on Heroku. 
Application error (500) TemplateLoadError: Loader cannot locate the template file "./X.html"

The includable template works fine on otree devserver.

Includable template is in the same folder of the main html and this is what I wrote in the main html:
{% include "./X.html" %}

Does anyone have any idea? 

Thanks in advance. 
Fong

Chris @ oTree

unread,
Apr 17, 2021, 4:24:51 PM4/17/21
to Yan Yi Fong, oTree help & discussion
Change it to {% include "my_app/X.html" %} rather than the dot.

Also check if the server is running the same version of otree. 

Sent from my phone

On Apr 18, 2021, at 4:04 AM, Yan Yi Fong <yany...@gmail.com> wrote:

Hello,
--
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/31891fb8-bbae-47cc-8c42-e60f0df2c40fn%40googlegroups.com.

Yan Yi Fong

unread,
Apr 17, 2021, 4:48:39 PM4/17/21
to oTree help & discussion
Hello,
thank you very much, it worked out!

Both of my servers weren't running on the same version, thank you for the tip.

Fong

Hector Yomar Aguilar Lucas

unread,
Dec 2, 2021, 12:54:42 PM12/2/21
to oTree help & discussion
Hello,

I have the same problem and I tried to follow the instructions from Chris but I don't know if I am doing well.

My App is called OrderQuantity Experiment and I have  10 Templates, when a I run my experiment in Heroku server, it run well only the templates from 1 to 5, and then not working and appear the error  TemplateLoadError: Loader cannot locate the template file ' OrderQuantity/treatment2.html'.

Just as  Yan Yi Fong my experiment work well in otree devserver.

I have some questions:

- I wrote before {% block title %} this line in each template {% include "OrderQuantity./treatment2.html" %} example for the page treatment2, it is correct? I guess no, because the error persist.
- I read you mention a main html, where is it? I have to write the code above into this main html.

Please help me, I tried to run the projects that I have imported from the otree course and all of them working in heroku except mine.

Chris @ oTree

unread,
Dec 3, 2021, 4:57:44 AM12/3/21
to oTree help & discussion
On Heroku, names are case sensitive. is the template called treatment2.html or Treatment2.html?

Hector Yomar Aguilar Lucas

unread,
Dec 3, 2021, 8:14:25 PM12/3/21
to oTree help & discussion
Hello Chris

Yeah, that was the problems. Into python script the name of the class is "treatment1", However the html file is called "Treatment1".

I have changed this, and now heroku is working.

Thanks you.

Reply all
Reply to author
Forward
0 new messages