Use Django Template Tags in img src [duplicate]
问题 This question already has answers here : django 1.5 - How to use variables inside static tag (5 answers) Closed 4 years ago . I am trying to use the Django template tags to bring up specific images that correlate with each choice, however it does not seem to work, just return a broken image. Here is my relevant html: <img class="img-responsive" src="{% static "images/risk_graphics/{{ input.choice }}.jpg" %}"/> Thanks for any help. 回答1: Just set a variable on the context containing the path to