oTree Forum >

How to add an image to a page

#1 by Sahar

Hi all,
I need to add an image from my pc to a page in my experiment. I used the code below in the html:

<img src="{{static 'Screenshot (17).jpg' }}" alt="Example of the Task" style="width: 750px">

The problem is that the link of the image cannot be resolved. The error is as below:

TemplateSyntaxError: Error while parsing the 'static' tag AssertionError: {% static %} tag takes 1 argument.

Does anyone have experience with that? How do you add an image to a page in general? 

Kind regards,
Sahar

#2 by Chris_oTree

Probably it doesn't allow spaces in the file name.

#3 by Sahar

Hi,
If I delete the space the image will be unknown. I think the problem should be related to static which I do not know how to fix it. 

Best,
Sahar

#4 by Chris_oTree

Just rename the file so it doesn't contain spaces.

#5 by Sahar

It worked. Thanks.

Write a reply

Set forum username