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
UPDATE: I realized templates folder is in App directory
If your templates folder is in your app directory, then:
STATICFILES_DIRS = [BASE_DIR / "home/static",]STATIC_URL = '/static/' like it isTEMPLATES >> DIRS path empty.<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>
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:
settings.py >> TEMPLATES, paste DIRS path like the following'DIRS': [os.path.join(BASE_DIR, 'templates')]
STATIC_URL = '/static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR
<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>
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