P
P
Prepod212020-03-16 22:43:55
Python
Prepod21, 2020-03-16 22:43:55

How to make Flask honor image path changes?

Build an app in Flask. The application contains html, css, js files. css and js files are located in app/static/css and app/static/js. The images are located in app/static/images. In one of the css files I specified

background-image: url('app/static/images/like-active.svg');

On launch I got: /app/static/images/like-inactive.svg HTTP/1.1←[0m" 404 -
changed css to:
background-image: url('/static/images/like-active.svg');

when I run it, I still get: /app/static/images/like-inactive.svg HTTP/1.1←[0m" 404 -

Why is this happening?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Arseny, 2020-03-17
Matytsyn @ArsenyMatytsyn

1. Check if there is still a picture there.
2. Look at the statics settings (have you overridden something, it happens, yes)
3. In a good mood in general, so that nginx manages the statics, if this is not the case already.
Yes, by the way, I climbed into the project at hand to look, does the url look like this (malol) and everything is exactly like that. Works even on local (where there is no nginx).

R
Roman, 2020-03-22
@skipirich

Relative path background-image: url('../images/like-active.svg'); tried?

P
Prepod21, 2020-03-23
@Prepod21

noticed that after a certain time flask starts to correctly interpret the path that is specified, but as soon as I change the path and flask does not react to the change and refers to the previous path.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question