问题:
django
setting.py 加上STATICFILES_DIRS后一直报Exception has occurred: SyntaxError
原因:(未知)
以下两种为我从django官网上复制的和其他博客上复制的格式.
但是就是不行,总是在 setting.py 文件中 os.path.join(BASE_DIR,‘hello’,‘static’) 存在的行
报错Exception has occurred: SyntaxError
STATICFILES_DIRS = [
os.path.join(BASE_DIR,'hello','static'),
os.path.join(BASE_DIR,'polls','static'),
]
STATICFILES_DIRS = (
os.path.join(BASE_DIR,'hello','static'),
os.path.join(BASE_DIR,'polls','static'),
)
解决:
索性把上面的代码重新抄写了一遍,然后就执行成功了…
STATICFILES_DIRS = [
os.path.join(BASE_DIR,'hello','static'),
os.path.join(BASE_DIR,'polls','static'),
]
结论:
就是网上复制粘贴下来的代码直接放到 setting.py后就报错了 (我的情况是这样的)