in web2py all links generated with URL are relative, unless you specify the 
host parameter.

I really don't see the problem: normally static files links are defined in 
layout.html and if you're using 
response.files.append(URL('tosomethingstatic')). How many are there in your 
app? 20, 30 ? Is it really a problem ?

If you don't want to change URL('static', 'css/myfile.css') to a plain 
http://cdn.cloudfront.com/whatever/static/css/myfile.css you can still use 
URL('static', 'css/myfile.css', host='http://cdn.cloudfront.com/whatever/') 
.

Or, you can use the routes facility, in routes_out

('/$app/static/$anything', 
'http://cdn.cloudfront.com/whatever/$app/static/$anything'),



On Monday, December 3, 2012 2:48:57 PM UTC+1, elyase wrote:
>
> Well if I am uploading my whole my static folder to cloudfront I wouldn't 
> like to have to manually change all my url links for every image, css, js 
> file in there, I know in Django you just change the static_url location in 
> the settings, isn't there something similar in Web2py?
>
> On Thursday, November 29, 2012 10:44:38 AM UTC+1, Niphlod wrote:
>>
>> instead of using URL('static', 'css/mycss.css') you use 
>> http://cnd.cloudfront.com/whatever/mycss.css 
>>
>> On Wednesday, November 28, 2012 10:33:39 PM UTC+1, elyase wrote:
>>>
>>> What is the way to go if one wants to distribute the static content via 
>>> Cloudfront CDN? I use Openshift and mod_proxy is there deactivated becasue 
>>> of performance issues so I guess I cant rewrite URLs at the server level. 
>>> How can I then change in Web2py the location of the static folder to a 
>>> Cloudfront distribution?
>>
>>

-- 



Reply via email to