On a Django 1.11 app deployed to Heroku. The Django management command findstatic
is saying that it cannot find a file angular.min.js
even though the file appears to be in a folder findstatic is checking.
$ heroku run python manage.py findstatic --verbosity 2 angular.min.js
Running python manage.py findstatic --verbosity 2 angular.min.js
No matching file found for 'angular.min.js'.
Looking in the following locations:
/app/static
/app/.heroku/python/lib/python3.6/site-packages/django/contrib/admin/static
/app/.heroku/python/lib/python3.6/site-packages/django_extensions/static
/app/.heroku/src/django-floppyforms/floppyforms/static
/app/.heroku/python/lib/python3.6/site-packages/rest_framework/static
$ heroku run ls /app/static/angular/
Running ls /app/static/angular/
angular.min.js controllers.js
So it appears that angular.min.js
is at /app/static/angular/. Why does findstatic
not find it?
Relevant part of settings.py:
I followed Heroku's instructions for service Static Files with Django:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
STATIC_URL = "/static/"
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"),]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
# ...others here too
]
Also, whitenoise
in requirements.txt
Related questions that did not solve my problem:
Django findstatic : No matching file found (STATICFILES_DIRS appears to me to be correctly set up)
django findstatic not looking in every directory (In my situation, findstatic appears to be looking in the correct parent directory)