I have base template core/layout.html
and it contains scripts
block in it:
<code><script type="text/javascript" src="{% static "core/js/tinymce/tinymce.min.js" %}"></script>
<script src = "{% static "core/js/flowbite.min.js" %}"></script>
<!-- <script src = "{% static "core/js/index.js" %}"></script> -->
{% block scripts %}
{% endblock scripts %}
</code>
<code><script type="text/javascript" src="{% static "core/js/tinymce/tinymce.min.js" %}"></script>
<script src = "{% static "core/js/flowbite.min.js" %}"></script>
<!-- <script src = "{% static "core/js/index.js" %}"></script> -->
{% block scripts %}
{% endblock scripts %}
</code>
<script type="text/javascript" src="{% static "core/js/tinymce/tinymce.min.js" %}"></script>
<script src = "{% static "core/js/flowbite.min.js" %}"></script>
<!-- <script src = "{% static "core/js/index.js" %}"></script> -->
{% block scripts %}
{% endblock scripts %}
So the problem is in url to javascript file (index.js
).
If I include it in layout.html
(base template) everything works perfect, but when i put it in my child template:
<code>{% block scripts %}
<script src="{% static 'core/js/index.js' %}"></script>
{% endblock scripts %}
</code>
<code>{% block scripts %}
<script src="{% static 'core/js/index.js' %}"></script>
{% endblock scripts %}
</code>
{% block scripts %}
<script src="{% static 'core/js/index.js' %}"></script>
{% endblock scripts %}
it throws an error:
GET 127.0.0.1:8000/static/%20core/js/index.js net::ERR_ABORTED 404 (Not Found)
I even have tried to hard code it, still the same problem.