added a new static file to my project by copy/paste into the static directory for my project. But I get 'File not found' when checking debug mode in the browser.
This is my folder structure:
- static
- projectname
-OldScript.js
-NewAwesomeScript.js
And this is my base.html
<script src="{% static 'projectname/OldScript.js' %}" type="text/javascript"></script>
<script src="{% static 'projectname/NewAwesomeScript.js' %}" type="text/javascript"></script>
This is the staticfiles_dir in settings.py:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
The oldscript.js have been in the project for a long time. Just wanted to add a new static file I need to load in base.html. So after copying the file to my folder I copy the include script code and changed the name to NewAwesomeScript.js.
It's not working and when checking debug in the browser, it says 'File not found 404'.
OldScript.j is loading, NewAwesomeScript.js is not loading.
Copy from Header for the old file that works:
Request URL:http://localhost:8000/static/projectname/OldScript.js
Request Method:GET
Status Code:200 OK (from disk cache)
Remote Address:127.0.0.1:8000
Referrer Policy:no-referrer-when-downgrade
And the Header for the new file:
Request URL:http://localhost:8000/static/projectname/NewAwesomeScript.js
Request Method:GET
Status Code:404 Not Found
Remote Address:127.0.0.1:8000
Referrer Policy:no-referrer-when-downgrade
Tried forcing refresh (ctrl + shift + F5)
I have restarted the server instance. It's in development. So not a production. Therefore I do not need to run 'collectstatic'. But desperate as I am, I also did this.
I have also checked read/write privileges.
Trying to find anything in the documentation about adding new static files. Without luck to finding my mistake.
What have I forgotten to do?