I have a Django (3.1) app that I've set up to serve static files, that is, myapp/settings.py
has
DEBUG = True
.
.
.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
.
.
.
]
.
.
.
STATIC_URL = '/static/'
STATIC_ROOT = 'static/'
But instead of serving files from the static
directory of myapp, it's serving static files from /Library/Python/3.7/site-packages/django/contrib/admin/static/
. I have tested this by adding files to both directories,
~/Projects/myapp/static/file-from-project.js
/Library/Python/3.7/site-packages/django/contrib/admin/static/file-from-library.js
and then
python3 manage.py runserver
with a template including the lines
<script src="{% static 'file-from-project.js' %}"></script>
<script src="{% static 'file-from-library.js' %}"></script>
and file-from-library.js
loads fine but I get a 404 for file-from-project.js
. What am I doing wrong here?
Directory structure with the referenced files:
myapp
/myapp
settings.py
.
.
.
/static
file-from-project.js
.
.
.
/templates
.
.
.
manage.py
.
.
.