这是我在尝试加载 {{STATIC_URL}}img/memestatlogo2.jpg 时收到的错误。为什么 django 不在 STATICFILES_DIRS 中查找 img/memestatlogo2.jpg?
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/static/img/memestatlogo2.jpg
Using the URLconf defined in memestat.urls, Django tried these URL patterns, in this order:
^$
The current URL, static/img/memestatlogo2.jpg, didn't match any of these.
以下是我的 settings.py 中的相关配置
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = ('/home/ryan/Programming/OpenCV-2.4.2/msheroku/memestat/stats/')
然后图像位于
'/home/ryan/Programming/OpenCV-2.4.2/msheroku/memestat/stats/img/memestatlogo2.jpg'