django - variable declared in base project does not appear in app
Posted
by unsorted
on Stack Overflow
See other posts from Stack Overflow
or by unsorted
Published on 2010-05-30T00:10:34Z
Indexed on
2010/05/30
0:12 UTC
Read the original article
Hit count: 321
I have a variable called STATIC_URL, declared in settings.py in my base project:
STATIC_URL = '/site_media/static/'
This is used, for example, in my site_base.html, which links to CSS files as follows:
<link rel="stylesheet" href="{{ STATIC_URL }}css/site_tabs.css" />
I have a bunch of templates related to different apps which extend site_base.html, and when I look at them in my browser the CSS is linked correctly as
<link rel="stylesheet" href="/site_media/static/css/site_tabs.css" />
(These came with a default pinax distribution.) I created a new app called 'courses' which lives in the ...../apps/courses folder. I have a view for one of the pages in courses called courseinstance.html which extends site_base.html just like the other ones.
However, when this one renders in my browser it comes out as
<link rel="stylesheet" href="css/site_tabs.css" />
as if STATIC_URL were equal to "" for this app. Do I have to make some sort of declaration to get my app to take on the same variable values as the project? I don't have a settings.py file for the app. by the way, the app is listed in my list of INSTALLED_APPS and it gets served up fine, just without the link to the CSS file (so the page looks funny).
Thanks in advance for your help.
© Stack Overflow or respective owner