On Jun 7, 2007, at 6:09 AM, Daniel Tang wrote:

> On 6/7/07, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote:
>
> > Also, for static resources, like images or CSS files that  
> actually are
> > on the proxy server proxying for the Paster server, how can I pass a
> > sort of "/media" path to my templates that would always be  
> resolved no
> > matter how deep the links are that are mapped?
>
> Personally, I'm lazy, so I just use absolute paths for the static
> resources.  Hence, I do things like "/images/foo.png".  I'm sure some
> badly behaving proxy out in the wild will bite me one of these days,
> but it hasn't yet.
>
> Best Regards,
> -jj
>
> I actually came across this last week.  If for some reason, you  
> want to install a Pylons application mapped to a subdirectory via  
> mod_proxy and Paster, such as on WebFaction, you'll see that the  
> 404 error breaks (in that no images show up).  I guess Paster  
> doesn't see that it's under a subdirectory, so it spits out the  
> wrong absolute path.  I don't really have an answer to that yet,  
> since I'm still fairly new to Pylons, but you could use a subdomain  
> as well, which could work better.  Maybe.
>

Use url_for and the WebHelper functions such as image_tag as they  
will always prefix urls with the appropriate SCRIPT_NAME value.

Then when deployed on a subdir behind a reverse proxy, use  
PrefixMiddleware:

http://pylonshq.com/docs/0.9.5/ 
application_configuration.html#prefixmiddleware

--
Philip Jenvey



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to