【发布时间】:2017-04-01 08:58:52
【问题描述】:
由于某种原因,djangobower.finders.BowerFinder 要加载的静态文件没有加载(在服务器中得到 404 Not Found)
settings.py
STATIC_ROOT = "/root/Desktop/django-DefectDojo/static/"
STATIC_URL = '/static/'
STATICFILES_DIRS = ()
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'djangobower.finders.BowerFinder',
)
BOWER_COMPONENTS_ROOT = '/root/Desktop/django-DefectDojo/components/'
BOWER_INSTALLED_APPS = (
'jquery-ui',
)
INSTALLED_APPS = (
'djangobower',
)
模板
<script src="{% static "jquery-ui/jquery-ui.min.js" %}"></script>
项目结构
-project root
-static
-components
-vendor
-assets
-bower-components
-jquery-ui
-jquery-ui.min.js
我先是./manage.py bower install,然后是./manage.py collectstatic
现在,在运行服务器时,我得到一个 Not Found。
但是,当我制作 STATICFILES_DIRS = ('/root/Desktop/django-DefectDojo/components/vendor/assets/bower_components/',) 时,静态文件会被加载。
但这不应该是这样,因为BowerFinder 应该这样做。
【问题讨论】:
标签: django bower django-staticfiles static-files