0

So I updated my project settings with the following scheme

PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

/settings
  base.py
  prod.py
  dev.py

Is this the correct STATICFILES_DIRS settings for the above configuration?

STATICFILES_DIRS = [
os.path.join(PROJECT_ROOT, "site_media", "static"),
]

STATIC_URL = "/site_media/static/"

The templates render just fine using

TEMPLATE_DIRS = [
     os.path.join(PROJECT_ROOT, "templates"),
]

So I'm a little turned around as to why my css files arent working

Home.html

<link rel="stylesheet" href="{{ STATIC_URL }}css/home.css" />
harristrader
  • 1,181
  • 2
  • 13
  • 20

1 Answers1

0

You might want to change your PROJECT_ROOT to something like this:

# cwd is settings. determine project path
cwd = os.path.dirname(os.path.abspath(__file__)) 
PROJECT_ROOT = cwd[:-9] # chop off "settings/"

That should get your project root where you want it. Also, what link is being created on the front end when you try to use {{STATIC_URL}}?

You might want to check out this link for more information on splitting up the settings.py file.

  • 1
    With regard to your question, when I visit the url the page renders and loads my site_base.html template but no css or javascipt static files load. – harristrader Oct 23 '12 at 19:40