Ask Your Question
1

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

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

this post is marked as community wiki

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

updated 2012-11-01 15:24:03 -0500

todofixthis gravatar image todofixthis flag of Chile
1092 17 18 37
http://www.fiveyearsabroa...

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 /

delete close flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

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

this post is marked as community wiki

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

updated 2012-11-01 10:10:05 -0500

siovene gravatar image siovene flag of Finland
401 7 5 24
http://www.astrobin.com/

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

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

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

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow

subscribe to rss feed

Stats

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

Seen: 40 times

Last updated: Nov 01 '12