Note that there are some explanatory texts on larger screens.

plurals
  1. POPerl Catalyst - Couldn't render template..........not found
    primarykey
    data
    text
    <p>I have a problem I am hoping someone is able to help with...</p> <p><strong>The error I am getting in the development server:</strong></p> <pre><code>[info] *** Request 2 (0.000/s) [681] [Thu Dec 12 21:05:39 2013] *** [debug] Path is "homescreen" [debug] "GET" request for "homescreen" from "192.168.1.100" [debug] Rendering template "homescreen/homescreen.tt2" [error] Couldn't render template "homescreen/homescreen.tt2: file error - homescreen/homescreen.tt2: not found" [error] Couldn't render template "homescreen/homescreen.tt2: file error - homescreen/homescreen.tt2: not found" [debug] Response Code: 500; Content-Type: text/html; charset=utf-8; Content-Length: 14312 [info] Request took 0.033915s (29.485/s) .------------------------------------------------------------+-----------. | Action | Time | +------------------------------------------------------------+-----------+ | /homescreen | 0.000341s | | /end | 0.014055s | | -&gt; Myproject::View::HTML-&gt;process | 0.013049s | '------------------------------------------------------------+-----------' </code></pre> <p><strong>What I am doing:</strong></p> <p><strong>I have the following <code>Controller/Homescreen.pm</code>:</strong></p> <pre><code>package Myproject::Controller::Homescreen; use strict; use warnings; use parent 'Catalyst::Controller'; use Data::Dumper; use JSON; __PACKAGE__-&gt;config-&gt;{namespace} = ''; sub homescreen :Path('/homescreen') :Args(0) { my ( $self, $c ) = @_; print STDERR "IN THE HOMESCREEN ACTION\n"; $c-&gt;stash({template =&gt; 'homescreen/homescreen.tt2', title =&gt; 'Home Screen' }); } </code></pre> <p><strong>I have the following <code>View/HTML.pm</code>:</strong></p> <pre><code>package Myproject::View::HTML; use Moose; use namespace::autoclean; extends 'Catalyst::View::TT'; __PACKAGE__-&gt;config({ #Changed default TT extension to TT2 TEMPLATE_EXTENSION =&gt; '.tt2', render_die =&gt; 1, }); </code></pre> <p><strong>I have the following <code>lib/Myproject.pm</code>:</strong></p> <pre><code>__PACKAGE__-&gt;config( name =&gt; 'Myproject', # Disable deprecated behavior needed by old applications disable_component_resolution_regex_fallback =&gt; 1, #enable_catalyst_header =&gt; 1, # Send X-Catalyst header ); __PACKAGE__-&gt;config( #Configure the view 'View::HMTL' =&gt; { #Set the location for TT files INCLUDE_PATH =&gt; [ __PACKAGE__-&gt;path_to( 'root', 'src' ), ], }, ); # Start the application __PACKAGE__-&gt;setup(); </code></pre> <p>I then have a <strong><code>root/src/homescreen/homescreen.tt2</code></strong> withing my Catalyst directory that contains all my html code (eventually it will use the template toolkit,but at the moment it is purely html and javscript code which I know is fine).</p> <p>The error I get on the application page in my browser is:</p> <pre><code>Couldn't render template "homescreen/homescreen.tt2: file error - homescreen/homescreen.tt2: not found" </code></pre> <p>I have tried using <code>DEBUG =&gt; 'undef'</code> in my HTML.pm View to help with debugging, but I don't seem to get any extra output.</p> <p><strong>There is probably something very obvious I am overlooking but I cannot work out what it is?</strong></p> <p><strong>---------------------------- UPDATE ----------------------------</strong></p> <p>I have just noticed the following in the <code>Config</code> section of my browser debug screen:</p> <p><strong>Config</strong></p> <pre><code> do { my $a = { "Action::RenderView" =&gt; { ignore_classes =&gt; [ "DBIx::Class::ResultSource::Table", "DBIx::Class::ResultSourceHandle", "DateTime", ], scrubber_func =&gt; sub { ... }, }, "disable_component_resolution_regex_fallback" =&gt; 1, "home" =&gt; "/home/fred/Myproject", "name" =&gt; "Myproject", "Plugin::ConfigLoader" =&gt; {}, "Plugin::Static::Simple" =&gt; { debug =&gt; 1, dirs =&gt; [], ignore_dirs =&gt; [], ignore_extensions =&gt; ["tmpl", "tt", "tt2", "html", "xhtml"], &lt;---- IS THIS SIGNIFICANT AT ALL? include_path =&gt; [ bless({ dirs =&gt; ["", "home", "fred", "Myproject", "root"], file_spec_class =&gt; undef, volume =&gt; "", }, "Path::Class::Dir"), ], mime_types =&gt; {}, mime_types_obj =&gt; bless({}, "MIME::Types"), no_logs =&gt; 1, }, "root" =&gt; 'fix', "stacktrace" =&gt; { context =&gt; 3, verbose =&gt; 0 }, "static" =&gt; 'fix', "View::HMTL" =&gt; { INCLUDE_PATH =&gt; [ bless({ dirs =&gt; ["", "home", "fred", "Myproject", "root", "src"], file_spec_class =&gt; undef, volume =&gt; "", }, "Path::Class::Dir"), ], }, }; $a-&gt;{"root"} = $a-&gt;{"Plugin::Static::Simple"}{include_path}[0]; $a-&gt;{"static"} = $a-&gt;{"Plugin::Static::Simple"}; $a; } </code></pre> <p><strong>I take it this means it is ignoring my template file because it has the <code>.tt2</code> file extension?</strong></p> <p><strong>However, I am not setting this <code>ignore_extensions</code> attribute anywhere in my Catalyst project?</strong> Is this the cause of my problem or something totally unrelated?</p> <p>Your help with this would be much appreciated, thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload