First time here? Check out the FAQ!
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 /

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
updated 12 years ago
This post is a wiki. Anyone with karma >100 is welcome to improve it.

Comments

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/'

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
answered 12 years ago
This post is a wiki. Anyone with karma >100 is welcome to improve it.
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 (12 years ago)
see more comments