Answer the question
In order to leave comments, you need to log in
How to connect js file to Django?
I am learning Django. Faced with the problem that it is not possible to connect js. In the same project, I connected css in the same way - everything works. I ask for advice on how to fix it. The error system does not issue or output a message from an external file. The application is called landing. Those. the path to the files is landing/static/landing/. In the script tag in the address, I write the following path landing / file name.
index.html file
<html>
<head>
{%load static %}
</head>
<div id = "blue">
Титул
<link rel="stylesheet" type="text/css" href="{%static 'landing/style.css' %}">
<script type="text/javascript" src="{% static 'landing/message.js' %}"></script>
</div>
</html>
alert('Если вам нужно создать качественный сайт, обратитесь в компанию');
Answer the question
In order to leave comments, you need to log in
Leave only alert in message.js.
<script type="text/javascript"> -------- > Удалить, используется только в теле html документа, type="text\js" можно уже не писать, валидатор ругается.
alert('Если вам нужно создать качественный сайт, обратитесь в компанию'); ----> Оставить
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question