views:

314

answers:

2

In Pylons I have a mako template linking to /static/resource.css. How do I automatically link to /pylons/static/resource.css when I decide to map the application to a subdirectory on my web server?

+1  A: 

What you want are static routes:

map.connect('resource', '/static/resource.css', _static=True)
iElectric
+2  A: 

If you want your static file links to be relative to your app root, wrap them like this in your templates (assuming Mako and Pylons 0.9.7):

${url('/static/resource.css')}

The root path of your app will be prepended. No need to define specific routes for each file.

Jason S