Soy nuevo en Django. Estoy tratando de agregar un javascript para mi barra de navegación. El navegador está leyendo correctamente el archivo CSS estático. Pero parece que el navegador está ignorando mi archivo javascript estático. Aquí está mi código:
Configuración.py
STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]índice.html
<html lang="en"> {% load static %} <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel='stylesheet' type='text/css' href="{% static 'style.css' %}"> <script type='text/javascript' src="{% static 'style.js' %}"></script> <title>{% block title %}{% endblock title %}</title> </head>Para comprobar si javascript funciona correctamente, solo he puesto un cuadro de alerta. Pero aún no muestra el cuadro de alerta.
estilo.js
alert("Checking");