Reference to static image in django using template -


for fun monitoring free disk space on linux box. have indexed mount points , store contents in mysql database. want display info using django. cron job automatically creates plots of free space last 24 hours. named "graph_day_drive_1.png" "graph_day_drive_3.png", number stands id of mount point. have put these images in static directory of app. now, want display them when showing details view selected mount point. i've read usual way access image is:

    <img src="{% static "diskspace/graph_day_drive_1.png" %}" alt="last 24h"/><br> 

which, of course, displays same image regardless of drive select. i've tried using following (drive refers model read database):

    <img src="{% static "diskspace/graph_day_drive_{{ drive.id }}.png" %}" alt="last 24h"/><br> 

but doesnt work creates following html code:

<img src="/static/diskspace/graph_day_drive_%7b%7b%20drive.id%20%7d%7d.png" alt="letzte 24h"/> 

which, obviously, doesn't work. can tell me proper way access these images?


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -