This is my project settings
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 file
{% load staticfiles %}
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
<link href="{% static "css/scrolling-nav.css" %}" rel="stylesheet">
Here is my project directory layout:
https://app.box.com/s/zurax1ytxt71jhi8ieaq
I thought I had set this up perfectly, but while my template html renders, the CSS/JS doesn't seem to work. Any ideas?
my answer is based on your project directory layout.
remove
STATIC_ROOT = 'staticfiles'
and change STATICFILES_DIRS like this:
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.