找不到页面......与Mojolicious

时间:2015-05-26 05:05:26

标签: perl mojolicious

我正在使用Mojilicious Lite。

#!/usr/bin/perl -T
use strict;
use Mojolicious::Lite;

get '/' => 'index';

# Run the Mojolicious script in CGI mode.
app->start;

#template
__DATA__
@@ index.html.ep
<!DOCTYPE html>
<html>
    <head>
        <title>My title</title>
    </head>

    <body>
        pass 15
    </body>
</html>

一切正常,但我有间歇性问题,有时我会收到错误页面说:

"Page not found... yet!
None of these routes could generate a response for your GET request for /, maybe you need to add a new one?"

这种情况很少发生(20次中有1次)

任何人都可以让我知道这是什么问题,我该如何克服它?

提前致谢..

我的错误日志是:

[Tue May 26 18:12:42 2015] [debug] GET "/".
[Tue May 26 18:12:42 2015] [debug] Routing to a callback.
[Tue May 26 18:12:42 2015] [debug] Template "index.html.ep" not found.
[Tue May 26 18:12:42 2015] [debug] Template "not_found.development.html.ep" not found.
[Tue May 26 18:12:42 2015] [debug] Template "not_found.html.ep" not found.
[Tue May 26 18:12:42 2015] [debug] Rendering inline template "3e3201ab0667c1fc7f39089209f0435c".
[Tue May 26 18:12:42 2015] [debug] Rendering inline template "b2d451b47e2053ce583cbfdf7bcc6006".

1 个答案:

答案 0 :(得分:0)

最后我发现这是一个带有朦胧光线的错误(在呈现内联模板时)。 bug report 1 bug report 2

我使用external templates

解决了我的问题

示例:

我的申请文件:

#!/usr/bin/perl -T
use strict;
use Mojolicious::Lite;

get '/' => 'index';

# Run the Mojolicious script in CGI mode.
app->start;

我的模板文件名为index.html.ep

<!DOCTYPE html>
<html>
    <head>
        <title>My title</title>
    </head>

    <body>
        pass 15
    </body>
</html>

注意:我们必须在模板目录中定义此文件。