E
E
Egorian2018-05-12 17:28:58
Django
Egorian, 2018-05-12 17:28:58

Image path without adding static?

Django jinja template engine.
There is an application like this:

jinjalesson
  /migrations
  /static
      /jinjalesson
           /css
           /img
          /js
 /templates
  /jinjalesson
      /wpapper.html
      /index.html

wrapper code:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,intial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
     

    {% load staticfiles %}
    <link rel="stylesheet" href="{% static 'jinjalesson/css/style.css' %}" type="text/css">
   

    <title>Title</title>
</head>
<body >
{% block content %}
{% endblock %}


</body>
<script src="{% static "jinjalesson/js/jquery.viewportchecker.min.js"  %}"></script>
<script src="{% static "jinjalessonjs/main.js" %}"></script>
</html>

index.html code:
{% block content %}
<body>

<img src="img/1014_web.png"   alt="" class="lang_img">
</body>
{% endblock %}

There are a bunch of images in index.html with this path.
Is it possible to make it so that not to prescribe {% load staticfiles%} in the index and to prescribe {% static ...%} for each image?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question