The STATICFILES_DIRS setting is not a tuple or list. Eventhough it did not contain a comma
Question:
HI I am new to static files but I got this error called STATICFILES_DIRS setting is not a tuple or list
. Which I do not understand as it is does not contain any commas. I hope someone can help me. Yes, I have imported os.
Traceback:
ERRORS:
?: (staticfiles.E001) The STATICFILES_DIRS setting is not a tuple or list.
HINT: Perhaps you forgot a trailing comma?
settings.py:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
STATICFILES_DIRS = (
os.path.join(BASE_DIR, '')
)
Answers:
Thanks to @fsimonjetz for helping me answer this question I changed this:
STATICFILES_DIRS = (os.path.join(BASE_DIR, '')
)
to
STATICFILES_DIRS = (os.path.join(BASE_DIR, ''),)
For people who didn’t understand why this error still shown even the location of directory is exist and clear.
Django asks for the STATICFILES_DIRS
to be on tuple or list structure because is expecting many directories as value, so it’s not efficient to assign only string
to STATICFILES_DIRS
So we need to put this direcory on []
or ()
.
HI I am new to static files but I got this error called STATICFILES_DIRS setting is not a tuple or list
. Which I do not understand as it is does not contain any commas. I hope someone can help me. Yes, I have imported os.
Traceback:
ERRORS:
?: (staticfiles.E001) The STATICFILES_DIRS setting is not a tuple or list.
HINT: Perhaps you forgot a trailing comma?
settings.py:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
STATICFILES_DIRS = (
os.path.join(BASE_DIR, '')
)
Thanks to @fsimonjetz for helping me answer this question I changed this:
STATICFILES_DIRS = (os.path.join(BASE_DIR, '')
)
to
STATICFILES_DIRS = (os.path.join(BASE_DIR, ''),)
For people who didn’t understand why this error still shown even the location of directory is exist and clear.
Django asks for the STATICFILES_DIRS
to be on tuple or list structure because is expecting many directories as value, so it’s not efficient to assign only string
to STATICFILES_DIRS
So we need to put this direcory on []
or ()
.