Hi,

One thing to note is that only the last engines block will have effect in your config (although that is clearly not the source of this problem).

I was able to reproduce your issue with the test app generated by dancer2 gen -a by adding a line after the template ... statement. My failing file:

package My::TestApp; use Dancer2; our $VERSION = '0.1'; get '/' => sub { template 'index' => { 'title' => 'My::TestApp' }; debug 'after templating'; }; true;
The debug log statement was printed to the log but no output was shown in the browser. Removing/commenting the line fixed the problem. I believe this is because the output of the last line in the handler is what is returned to the browser. (From the doc: "Note that template simply returns the content, so when you use it in a route handler, if execution of the route handler should stop at that point, make sure you use return to ensure your route handler returns the content.") Adding a line with output shows this:
package My::TestApp; use Dancer2; our $VERSION = '0.1'; get '/' => sub { template 'index' => { 'title' => 'My::TestApp' }; debug 'after templating'; 'foo'; }; true;
The browser shows 'foo' with this code.

Do you have any other code in the route handler in sandbox.pm after the template statement?

Hope this helps!

Update: added quote from the doc


The way forward always starts with a minimal test.

In reply to Re: Why won't my Dancer2 app render any output??? by 1nickt
in thread Why won't my Dancer2 app render any output??? by traveler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.