Django collectstatic no such file or directory Django collectstatic no such file or directory django django

Django collectstatic no such file or directory


try this:

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

and leave this empty, since you are using STATIC_ROOT

STATICFILES_DIRS = (  # Put strings here, like "/home/html/static" or "C:/www/django/static".  # Always use forward slashes, even on Windows.  # Don't forget to use absolute paths, not relative paths.)

it should work this way.


Files in STATICFILES_DIRS need to have absolute path.Use normpath.

STATICFILES_DIRS = (    normpath(join(BASE_DIR, 'static')),    normpath(join(BASE_DIR, 'upload')),)

Also it is good to set STATIC_ROOT to something like

STATIC_ROOT = normpath(join(BASE_DIR, 'assets'))

and STATIC_URL

STATIC_URL = '/static/'


So I was having similar problem and followed what fraggles had suggested, but I was getting this follow up error:

NameError: name 'normpath' is not defined

My work around was switching the '.dirname' keyword for '.normpath' keyword instead:

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

And it worked like magic. Hopefully this solution also helps someone.