3

나는 누군가와 함께 ...펄 촉매 - 템플릿을 렌더링 할 수 없습니다 .......... 발견되지

나는 점점 오전 오류 도움을 줄 수있다 바라고 문제가 개발 서버 :

[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 | 
| -> Myproject::View::HTML->process       | 0.013049s | 
'------------------------------------------------------------+-----------' 

내가 뭐하는 거지 :

나는 Controller/Homescreen.pm 다음 한 :

package Myproject::Controller::Homescreen; 

use strict; 
use warnings; 
use parent 'Catalyst::Controller'; 
use Data::Dumper; 
use JSON; 

__PACKAGE__->config->{namespace} = ''; 

sub homescreen :Path('/homescreen') :Args(0) { 

     my ($self, $c) = @_; 
     print STDERR "IN THE HOMESCREEN ACTION\n"; 


     $c->stash({template => 'homescreen/homescreen.tt2', 
        title => 'Home Screen' 
       }); 
} 

나는 View/HTML.pm 다음과 같습니다

package Myproject::View::HTML; 
use Moose; 
use namespace::autoclean; 

extends 'Catalyst::View::TT'; 

__PACKAGE__->config({ 
    #Changed default TT extension to TT2 
    TEMPLATE_EXTENSION => '.tt2', 
    render_die => 1, 
}); 

나는 lib/Myproject.pm 다음과 같습니다

__PACKAGE__->config(
    name => 'Myproject', 
    # Disable deprecated behavior needed by old applications 
    disable_component_resolution_regex_fallback => 1, 
    #enable_catalyst_header => 1, # Send X-Catalyst header 
); 

__PACKAGE__->config(
     #Configure the view 
     'View::HMTL' => { 
       #Set the location for TT files 
       INCLUDE_PATH => [ 
         __PACKAGE__->path_to('root', 'src'), 
       ], 
     }, 
); 


# Start the application 
__PACKAGE__->setup(); 

내가 모든 포함하는 내 촉매 디렉토리를 withing에 root/src/homescreen/homescreen.tt2이 내 HTML 코드 (eventu 동맹국은 템플릿 툴킷을 사용할 것입니다. 그러나 지금은 순전히 html이고 javscript 코드는 괜찮습니다.)

내 브라우저에서 응용 프로그램 페이지에서 얻을 오류 :

Couldn't render template "homescreen/homescreen.tt2: file error - homescreen/homescreen.tt2: not found" 

내가 디버깅에 도움이 내 HTML.pm보기 DEBUG => 'undef'를 사용하여 시도했다, 그러나 나는 여분을 얻을하지 않는 것 산출.

내가 간과하고있는 부분이 있을지 모르지만 나는 그것이 무엇인지 알아낼 수 없습니까?

----------------------------- 업데이트 ---------------

구성

do { 
    my $a = { 
    "Action::RenderView" => { 
     ignore_classes => [ 
          "DBIx::Class::ResultSource::Table", 
          "DBIx::Class::ResultSourceHandle", 
          "DateTime", 
         ], 
     scrubber_func => sub { ... }, 
    }, 
    "disable_component_resolution_regex_fallback" => 1, 
    "home" => "/home/fred/Myproject", 
    "name" => "Myproject", 
    "Plugin::ConfigLoader" => {}, 
    "Plugin::Static::Simple" => { 
     debug => 1, 
     dirs => [], 
     ignore_dirs => [], 
     ignore_extensions => ["tmpl", "tt", "tt2", "html", "xhtml"], <---- IS THIS SIGNIFICANT AT ALL? 
     include_path => [ 
     bless({ 
      dirs => ["", "home", "fred", "Myproject", "root"], 
      file_spec_class => undef, 
      volume => "", 
     }, "Path::Class::Dir"), 
     ], 
     mime_types => {}, 
     mime_types_obj => bless({}, "MIME::Types"), 
     no_logs => 1, 
    }, 
    "root" => 'fix', 
    "stacktrace" => { context => 3, verbose => 0 }, 
    "static" => 'fix', 
    "View::HMTL" => { 
     INCLUDE_PATH => [ 
     bless({ 
      dirs => ["", "home", "fred", "Myproject", "root", "src"], 
      file_spec_class => undef, 
      volume => "", 
     }, "Path::Class::Dir"), 
     ], 
    }, 
    }; 
    $a->{"root"} = $a->{"Plugin::Static::Simple"}{include_path}[0]; 
    $a->{"static"} = $a->{"Plugin::Static::Simple"}; 
    $a; 
} 

I : -------------

난 그냥 내 브라우저 디버그 화면의 Config 섹션에서 다음을 발견했습니다 받아들이면 내 템플릿 파일을 무시한다는 의미입니다. 파일 확장자는 .tt2입니까?

그러나 Catalyst 프로젝트의 아무 곳에 나이 ignore_extensions 속성을 설정하지 않습니까? 내 문제의 원인인가 아니면 전혀 관련이없는 것입니까?

이와 당신의 도움이 많이 주시면 감사하겠습니다

, 감사

구성이 효과를 참가하는 것 같습니다
+0

당신은 루트 사용자입니까? 웹 서버가 루트로 실행되지 않아서 템플릿을 찾을 수없는 경우 일 수 있습니다. [CWD] (http://perldoc.perl.org/Cwd.html)를로드하고 컨트롤러에 'die cwd;'와 같은 것을 넣어 자신의 물건이 어디에서 돌아가고 있는지 확인하십시오. 그것이 다른 사용자의 홈 디렉토리에 있다면, 사용자는'/ root'에서 파일을 읽을 권한이 없습니다. – simbabque

+0

게시하기 전에 파일 사용 권한을 확인했습니다 (언급하는 것을 잊어 버렸습니다). 또한 개발 서버를 루트로 실행하려고했지만 아무런 차이가 없었습니다. 여전히 동일한 오류 메시지가 나타납니다. 다른 아이디어? 감사합니다 –

+0

'__PACKAGE __-> config -> { 'View :: HTML'}'을 STDERR로 덤프하고 예상 경로가 맞는지 확인하십시오. – RET

답변

1

. 템플릿을 root/src/homescreen/homescreen.tt2 대신 root/homescreen/homescreen.tt2에 넣으면 Catalyst에서 찾습니다.

아, lib/Myproject에 오타가 있습니다.오후 :

__PACKAGE__->config(
     #Configure the view 
     'View::HMTL' => { 

대신 'View::HTML' 시도는 (- 잘못된 맞춤법이 HMTL이 알).

+0

그레이트 자리, 고마워요 ... 나는 그것이 명백한 것이지만 꽤 명백하지 않을 것이라고 기대하고있었습니다 ... 나는 이것을 보았던 시간의 양을 알아 내야했습니다 - 다시 한 번 감사드립니다 –

+1

RET의 첫 번째 정리 : 디버깅 문제는 해결책이 당신이 생각할 마지막 사항입니다. :-) – RET