Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

242
Visualizações
Django fails to load javascript file but has no trouble server a css file in the same directory

I receive a Failed to load resource: the server responded with a status of 404 (Not Found) for the javascript file. The page loads fine but the javascript resource isn't obtained despite being in the same static folder as the css file which django has no trouble collecting.

settings.py

STATIC_URL = '/static/'
 
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
#STATIC_ROOT = os.path.abspath(os.path.join(os.path.dirname(BASE_DIR), 'static'))
STATIC_ROOT = 'static/'
STATIC_DIR = os.path.join(BASE_DIR, 'static')
STATICFILES_DIR=[STATIC_DIR]

html


{% load static %}
asdfs
<link rel="stylesheet" type="text/css" href="{% static 'polls/styles.css' %}">
<body id='app'>
    <p>i'm testing again</p>
      <li><a href="www.google.com">google</a></li>
  <script  type="text/javascript" src="{% static 'polls/reactfile.js'
%}"></script>
</body>
</html>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda