[Dancer-users] deploying multiple dancer websites on localhost with mod_proxy

David Precious davidp at preshweb.co.uk
Tue Mar 9 00:58:21 CET 2010


On Monday 08 March 2010 23:21:00 P Kishor wrote:
> On Mon, Mar 8, 2010 at 5:04 PM, P Kishor <punk.kish at gmail.com> wrote:
> > Now, when I point my browser at http://localhost/punkishdance, I get
> > my website, except...
> >
> > the browser can't retrieve stuff under ~/dance/punkishdance/public,
> > for example, the browser throws a 404 for
> > http://localhost/punkishdance/public/css/grid.css which is at
> > ~/dance/punkishdance/css/style.css
> >
> > I can't get it directly, and of course, I can't get it included in web
> > page, via main.tt. How do I correct this?

Is the file really in $appdir/css/style.css, or did you mean 
$appdir/public/css/style.css?  (It should be the latter).


> In fact, the browser is unable to get any file directly from under
> ~/dance/punkishdance

Indeed, the only files which should be automatically served are those in 
$appdir/public (for instance, ~/dance/punkishdance/public/).

(And, if you're using the new auto_page feature, Dancer will look for a 
matching template in the views dir if no route matched.

Which leads me nicely on to...
 
> > Which brings me to an associated question. I have the following routes in
> > my app
> >
> > get '/:p' => sub {
> >    pass unless (defined params->{p});
> >    template 'page', { page => _page(params->{p}), name => params->{p} };
> > };

You should find the auto_page feature ideal for that... with that enabled, 
creating $appdir/views/mypage.tt means the a request for /mypage will 
automatically be handled using that view, without you needing to declare any 
route to match it.

-- 
David Precious <davidp at preshweb.co.uk>
http://blog.preshweb.co.uk/    www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/identica    www.lyricsbadger.co.uk

  "Programming is like sex. One mistake and you have to support 
  it for the rest of your life". (Michael Sinz)


More information about the Dancer-users mailing list