Skip to content Skip to sidebar Skip to footer

Django Doesn't See Static Files

So the thing is that django simply can't recognize the static files. No matter what have I tried it just doesn't work. I tried changing the from global searching way to a direct ur

Solution 1:

Go some steps back and set up static files and make sure it follows exactly django docs

Only about static files

This project has similar structure as yours

When collectstatic is run, the default STATICFILES_FINDERS value django.contrib.staticfiles.finders.FileSystemFinder will collect your static files from any paths that you have in STATICFILES_DIRS.

The other default STATICFILES_FINDERS value django.contrib.staticfiles.finders.AppDirectoriesFinder will look in the /static/ folder of any apps in your INSTALLED_APPS.

All of the static files that are found will be placed in the specified STATIC_ROOT directory.

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]

STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_cdn")

You can also use python manage.py findstatic to see which directories collectstatic will look in.

manage.py findstatic

Solution 2:

Currently you have a typo - STATIC_DIRS instead of STATICFILES_DIRS, so collectstatic is not configured at all currently.

Fix it, then run collectstatic again.

Post a Comment for "Django Doesn't See Static Files"