my image is not showing in my website.Screenshot is attached below:

17 views
Skip to first unread message

Avitab Ayan Sarmah

unread,
Jun 6, 2018, 1:09:19 PM6/6/18
to Django users
index.html:

{% load static %}
<img src="{% static "my_app/example.jpg" %}" alt="My image"/>

<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" />
{% if latest_question_list %}
  <ul>
  {% for question in latest_question_list %}
      <li><a href="{% url 'polls:detail' question.id %}">{{
question.question_text }}</li></a>
  {% endfor %}
  </ul>
{% else %}
  <p>No polls are available.</p>
{% endif %}


results.html:

<h1>{{ question.question_text }}</h1>

<ul>
{% for choice in question.choice_set.all %}
  <li>{{ choice.choice_text }} -- {{ choice.votes }} vote{{
choice.votes|pluralize }}</li>
{% endfor %}
</ul>

<a href="{% url 'polls:detail' question.id %}">vote again?</a>


detail.html:

<h1>{{ question.question_text }}</h1>

{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}

<form action="{% url 'polls:vote' question.id %}" method="post">
{% csrf_token %}
{% for choice in question.choice_set.all %}
  <input type="radio" name="choice" id="choice{{ forloop.counter }}"
value="{{ choice.id }}" />
  <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}
</label><br />
{% endfor %}
<input type="submit" value="vote" />
</form>

Capture.PNG
Reply all
Reply to author
Forward
0 new messages