On Wed, Sep 28, 2011 at 1:17 PM, Assaf Gordon <gordon@cshl.edu> wrote:
Brian E. Lozier wrote, On 09/28/2011 04:14 PM:
>
>
> On Wed, Sep 28, 2011 at 1:07 PM, Assaf Gordon <gordon@cshl.edu <mailto:gordon@cshl.edu>> wrote:
>
>     Has anyone been able to deploy a Dancer application *not* under the server's root URL,
>     without changing code/templates in the Dancer application itself ?
>
> The only thing I can think of is to rewrite the html on the way out such that all calls to /images/ get the prefix.  The problem is that all your templates are hard coding a path to a resource on the server.  You're telling the browser what resource to request and you're giving it an "absolute" path.  You could also give them "relative" paths such as:
>
> <img src="images/foo.png">
>
> Which will work fine as long as you don't have any routes that are deeper.
>
> Why don't you just have a configuration parameter in your config file that says "path" and then use that instead of "[% request.uri_base %]"?  I don't quite get why you're using uri_base anyway.  All you have to do is say:

This configuration parameter is exactly what started this thread (The app-wide "prefix" setting - in the subject line) :)
And I keep learning that it's a bad idea, but haven't yet understood how to do it without such parameter.

I'm suggesting creating a new config variable for your apps, not reusing the prefix one.  Although I'm not sure why you wouldn't want to use the prefix one, I'll go back and read the beginnings of the thread.
 
_______________________________________________
Dancer-users mailing list
Dancer-users@perldancer.org
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users