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

297
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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