New to django here. I'm having trouble connecting with javascript code from django python. I think I've followed the documentation on project configuration.
HTML template:
<!DOCTYPE html>
<html lang="en">
<body>
Test template<br>
{% csrf_token %}
{% load static %}
{{ form | safe }}
<script type="text/javascript" src="{% static '/grid_1/test_script.js' %}"></script>
Test template end<br>
</body>
View function:
def test_view(req: djhp.HttpRequest):
form = forms.TestForm(); vals = dict()
vals["test_val"] = "This is a test"
return djsc.render(req, "test_template.html", vals)
JavaScript code:
alert("test script start")
var x = "{{ test_val }}"
alert(x)
The second javascript alert displays "{{ test_val }}" instead of "This is a test". So it looks like django is not processing the .js file. Any help for this newbie is much appreciated!