Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

225
Views
Django unable to find scripts in static folder

This might seem like a duplicate question but I dont whats going on but I have gone through stackoverflow and tried all the solutions but cant find the answer that I need. Here Django finds the style.css but cannot find the App.js and script.js literally located in the same folder as style.css. I cant seem to figure out the problem, I have wasted around 2 hrs trying to figure it out. UPDATE: I tried hard coding the path and still says it didn't find it while shows up when I do py manage.py findstatic.
Relevant HTML

{% load static %}
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
  <meta charset="UTF-8">
  <title>Reyanna</title>
  <link rel="icon" href="https://img.icons8.com/nolan/96/bot.png" type="image/icon type">
  <link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700,800,900" rel="stylesheet">
  <link rel="stylesheet" href="{% static 'style.css' %}">
  <link rel="script" href="{% static 'App.js' %}">
  <link rel="script" href="{% static 'script.js' %}">
</head>

Settings.py

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    BASE_DIR / "home/static",
]

Folders

  • Home(Django App)
  • |-> static
    • |-> App.js
    • |-> script.js
    • |-> style.css
  • |-> templates
    • |-> index.html
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

UPDATE: I realized templates folder is in App directory

If your templates folder is in your app directory, then:

  • Delete this STATICFILES_DIRS = [BASE_DIR / "home/static",]
  • Leave STATIC_URL = '/static/' like it is
  • Leave TEMPLATES >> DIRS path empty.
  • Last, in your base.html or index.html, add <scripts>----</scripts> tags before the closing body tag like the following
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
  • Clear your browser history including all cookies and reload server.

If it is not successful, I suggest to check for missing closing tag in your html or tag name typo.

But if templates folder is within project directory then do the following:

  • In settings.py >> TEMPLATES, paste DIRS path like the following
'DIRS': [os.path.join(BASE_DIR, 'templates')]
  • Also copy paste the following in the bottom of settings.py
STATIC_URL = '/static/'

STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)

MEDIA_URL = '/media/'

MEDIA_ROOT = BASE_DIR
  • Last, in your base.html or index.html, add <scripts>----</scripts> tags before the closing body tag like the following
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
  • Clear your browser history including all cookies and reload server.

If it is not successful, I suggest to check for missing closing tag in your html or tag name typo.

For exact examples of both, visit my GitHub repo and have a look to settings.py and base.html

Templates folder inside App directory

Templates folder within project directory

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!