Reputation: 53
I am reading the book "Tango with Django".
I tried to access a jpg file via URL. I get this error:
File "/home/studpro/.local/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 61, in __init__
prefix, root = root ValueError: need more than 1 value to unpack
My settings.py
looks like this:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATE_DIR = os.path.join(BASE_DIR, 'templates')
STATIC_DIR = os.path.join(BASE_DIR, 'static'),
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
STATICFILES_DIRS = [STATIC_DIR,]
I am running Django 1.10.08 and Python 2.7.
Anyone has a clue what could be the mistake?
Upvotes: 2
Views: 348
Reputation: 81594
You have a trailing comma on this line
STATIC_DIR = os.path.join(BASE_DIR, 'static'),
# ^
It causes STATIC_DIR
to be a tuple instead of a string, which then makes STATICFILES_DIRS
a list of tuples instead of a list of strings.
Delete that comma.
Upvotes: 4