Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

296
Vistas
Why doesn't my html file get my javascript file. load static

here is my settings.py:

    STATIC_DIR = os.path.join(BASE_DIR,'static')
    STATIC_URL = '/static/'
    STATICFILES_DIR = [STATIC_DIR]

here is the end of my html page:

   {% load static %}
       <script src="{% static '/js/script.js' %}" type="text/javascript"></script>
   </html>
   {% endblock %}

I have a folder static and inside it, there are two more folders one is js and the other is css. But when I try to load it, it always says "GET /static/js/script.js HTTP/1.1" 404 1795 I have tried many things but it does not work. Someone please help.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If it is development server (i.e DEBUG = True), then try this:

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    'static',
)
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

If it is production server, then you simply remove the STATICFILES_DIR. The official documentation explains this more in depth.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda