ApathyBear
ApathyBear

Reputation: 9615

Django static CSS for page not being found (development)

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?

Upvotes: 0

Views: 151

Answers (1)

Hasan Ramezani
Hasan Ramezani

Reputation: 5194

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'),
)

Upvotes: 1

Related Questions