[英]Django static CSS for page not being found (development)
这是我的项目设置
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_URL = '/static/'
STATIC_ROOT = 'staticfiles'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, '../static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
HTML文件
{% load staticfiles %}
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
<link href="{% static "css/scrolling-nav.css" %}" rel="stylesheet">
这是我的项目目录布局:
https://app.box.com/s/zurax1ytxt71jhi8ieaq
我以为我已经完成了此设置,但是当我的模板html呈现时,CSS / JS似乎无法正常工作。 有任何想法吗?
我的答案基于您的项目目录布局。
去掉
STATIC_ROOT = 'staticfiles'
并像这样更改STATICFILES_DIRS :
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.