S
S
sha2562019-12-19 13:20:04
Django
sha256, 2019-12-19 13:20:04

How to include JavaScript in Django?

Friends, hello everyone!
I'm doing the first project on Django (2.2.8), I can't connect JS to the index.html of the application.
{% load static %} - declared.
STATIC_URL = '/static/' - set
I declare:

<script type="text/javascript" scr={% static "js/jquery.min.js" %}></script>
        <script type="text/javascript" scr={% static "js/main.js" %}></script>

Main.js has a regular alert. But nothing happens. And in the resources of the browser JS is also not loaded. The files themselves are readable.
Tell me what I'm doing wrong.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Gilfanov, 2019-12-19
@sha256

<script type="text/javascript" src={% static "js/jquery.min.js" %}></script>
<script type="text/javascript" src={% static "js/main.js" %}></script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question