Ask Your Question
1

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

asked 2012-11-01 09:45:51 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

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 /

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-11-01 10:10:05 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

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

STATIC_URL = '//static.example.com/media/'
edit flag offensive delete link more

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 gravatar imagesysko ( 2012-11-01 10:32:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-11-01 09:45:51 -0600

Seen: 101 times

Last updated: Nov 01 '12