Locally stored background image for django jumbotron -


the background image correctly displayed when enter url of external image (google in example):

<div class="jumbotron" style="background-image:  url(https://www.google.co.uk/logos/doodles/2014/cricket-t20-world-cup-2014-final-5735702968926208-hp.jpg); background-size: cover;"> 

but not when use image stored locally (static/media/leaving.png), neither

<div class="jumbotron" style="background-image: {{media_root}}leaving.png; background-size: cover;"> 

nor

<div class="jumbotron" style="background-image:  url({{media_root}}leaving.png); background-size: cover;"> 

the settings.py contains media_root = os.path.join(os.path.dirname(base_dir), "static", "media").

how can display locally stored image in background?

you shouldn't using media_root, contains local file path, media_url, contains url local media files.

(actually, sure mean media rather static? former assets uploaded users, whereas latter permanent assets provided application.)


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -