It probably isn't mistake in your static files settings. But to be sure the relevant settings for static
folder in app directories is STATICFILES_FINDERS
https://docs.djangoproject.com/en/2.1/ref/settings/#staticfiles-finders. But the AppDirectoriesFinder
should be present by default so it is probably OK.
Your problem is probably in your URL scheme:
For development purposes make sure you have django.contrib.staticfiles
in your installed apps, DEBUG = True
and STATIC_URL = '/static/'
(or something similar). Then you should be able access the files.
For deploying it is more complicated but essentially you have setup STATIC_ROOT
, before starting the server run python manage.py collectstatic
command which will copy all static files to one location and then setup your server (Nginx) to serve the files from this folder under /static/
URL. Here is the official documentation https://docs.djangoproject.com/en/2.1/howto/static-files/#deployment
Note: if your app is foo
and you have bar
file in your static
directory under foo
app the URL for the file will be /static/foo/bar
.