I can't acces to images files in persisten volume - Python Web app

I added a new volume for my machine to persist images from being deleted with the continuous deploy but i cant access to them from html.
Im having problem with this.

{{p[6]}} is the dynamic name for the img.

I have to configure something else?


Hi @Stelios

Could you post the snippet of html that’s referencing the image? It would help to know what path you’re using.

Hi @andie,

Sorry, I thought that I had posted a photo of it.


The ‘for’ loop is sent from the application with a return, and I have also confirmed that the ‘{{p[6]}}’ was printed correctly.

i also tried with relative path (…/…/…/…/…/persistent/upl/{{p[6]}}) but nothing works

The route of html is /app/src/templates/repuesto/home.html

This might be a permissions issue, with your image belonging to the root user. Your app must be running as a non-root user?

You should be able to set permissions with chown via ssh. See also: Can't create Sqlite database in mounted volume - #6 by kurt

If that’s not the problem, hoping someone else can jump in and help. :slight_smile:

@andie I tought that too but the directory and the img have 777 permissions :frowning: i don’t know if i have to configure something else

You could try testing the image using a direct link like <img src="/persistent/upl/image.jpg"> just to rule out any issues there.

Thank for your help, i tried with a direct link too. I resolved it, the issue was the url defined by flask, that’s why i can upload images in that volume but not read them.

So, i created the volume inside the “static” route defined by flask and was resolved

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.