1

STATIC_URL value gets mangled when specifying URL starting with 'http://'

If I specify

STATIC_URL  = "http://static.example.com/media"

in the html I will get

http:/static.example.com/media

(the double / of http:// is replaced by one)

After investigation it seems to me that the problems come from this line in ./askbot/skins/utils.py:

url = os.path.normpath(url).replace('\\', '/')

(line 163 on the current source code) , normpath may replace the // by /

updated 2012-11-01 09:45:51 -0500
This post is a wiki. Anyone with karma >100 is welcome to improve it.
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

If that's a CDN, and probably also if it's not, just do this:

STATIC_URL = '//static.example.com/media/'
answered 2012-11-01 10:10:05 -0500
This post is a wiki. Anyone with karma >100 is welcome to improve it.
edit flag offensive 0 remove flag delete link

Comments

though it does solve my problem i see two problems to this solution: 1 - it's no more like the django normal usage and should at least be precised in the comments of settings.py 2 - does it work well with https ?

sysko's avatar sysko (2012-11-01 10:32:03 -0500) edit
add a comment see more comments