I have a django project where I have kept all the static files in a project level static
directory.
I have included
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
in the settings.py
. ALso I have added + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
to the urlpatterns in the project level urls.py.
My issue is that some of the static files load whereas some do not. For. eg. I am using django_google_maps
and the (example url) http://127.0.0.1:8000/static/django_google_maps/js/google-maps-admin.js
loads right and the corresponding work is done.
But when I try to load my custom js/css/any-static files, (example url http://127.0.0.1:8000/static/images/favicons/favicon.ico
or http://127.0.0.1:8000/static/js/image-upload-script.js
), they do not load and raise a django.views.static.serve
error with 404 not found.
They are right there in the directory though. I see that the static files used by third party packages are loading right but not my custom ones.
What is it that I am missing? Do we require something else to load our custom js/css files?? And yes I have used {% load static %}
in my template.