Django: how correctly set static files (css, js, etc.)?


#1

I have installed django app on dreamhost with passenger.
I have the folders media and static in public folder.
The settings.py file is like below:

[quote]STATIC_ROOT = '/home/user/domain/public/static/'
STATIC_URL = ‘http://www.domain/static/’[/quote]

but in template {{STATIC_URL}} is substituted with null string ‘’".

So if i have in my page the path {{STATIC_URL}}js/file.js
the result is only ‘/js/file.js’ and not “http://domain/static/js/file.js

In settings.py STATICFILES_FINDERS are specified and STATICFILES_DIRS also is specified.
Some help?


#2

isn’t that what you would want? i thought relative URLs are preferred?


#3

I want that {{STATIC_URL}} is replaced by http://www.domain/ as specified in settings.py.

I use STATIC_URL variable on localhost, so i would use this on dreamhost too.

It seems that server doesn’t recognize STATIC_URL as variable to be used in template.