TemplateSyntaxError: All content must be inside a block tag

314 views
Skip to first unread message

Elman Torres

unread,
Sep 17, 2021, 6:15:27 PM9/17/21
to oTree help & discussion
Hello Everyone,

I recently upgrade otree. I had apps without problems. But now when I try to run these apps show me the following error message 

"All content must be inside a block tag", token
otree.templating.errors.TemplateSyntaxError: All content must be inside a block tag (line 3, in "<body")


I don´t Know how to fix this problem. Can you help me, please.

Best,

Elman

Chris @ oTree

unread,
Sep 17, 2021, 6:47:51 PM9/17/21
to oTree help & discussion
All content must be inside a block. For example:

BAD
{{ block title }} GOOD {{ endblock }}
{{ block content }}
GOOD
{{ endblock }}
BAD

That content you currently have outside of the block has no effect. So you should either put it inside a block, or delete it.
Old versions of oTree didn't warn about this, but the newest version raises an error to let you know.

Chris @ oTree

unread,
Sep 17, 2021, 6:55:00 PM9/17/21
to oTree help & discussion
By the way, you don't need <body> in your template code. oTree automatically adds the <body> tag.

Elman Torres

unread,
Sep 17, 2021, 7:02:18 PM9/17/21
to oTree help & discussion
Hello Chris,

Thank you.

Best,

Elman

dklin...@gmail.com

unread,
Sep 23, 2021, 3:12:29 PM9/23/21
to oTree help & discussion
Hi,

On this point, inside what block would you put the internal css <style> </style> script? 



Chris Crabbe

unread,
Sep 23, 2021, 3:35:56 PM9/23/21
to dklin...@gmail.com, oTree help & discussion
Hi -

I use {{ block styles }} for that.

Thanks,
--Chris

--
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/7567a96b-7121-42bd-943c-d2847fe91bcan%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages