On Mon, Mar 8, 2010 at 5:58 PM, David Precious <davidp@preshweb.co.uk> wrote:
On Monday 08 March 2010 23:21:00 P Kishor wrote:
On Mon, Mar 8, 2010 at 5:04 PM, P Kishor <punk.kish@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.
ok, I found and read up on the auto_page setting. That doesn't seem to be what I want. I want stuff in $appdir/public to be served directly, and that is not happening right now. -- Puneet Kishor