我写了一个在本地运行没有问题的应用程序
在尝试进入某个页面时将应用程序部署到Heroku后,我收到以下错误(取自日志):
- 2012-02-29T00:11:53+00:00 app[web.1]: Internal Server Error (500) for request GET /Application/adminPage
- 2012-02-29T00:11:53+00:00 app[web.1]: Template not found (In /app/controllers/Application.java around line 78)
- 2012-02-29T00:11:53+00:00 app[web.1]:
- 2012-02-29T00:11:53+00:00 app[web.1]: at play.mvc.Controller.renderTemplate(Controller.java:667)
- 2012-02-29T00:11:53+00:00 app[web.1]:
- 2012-02-29T00:11:53+00:00 app[web.1]: play.exceptions.TemplateNotFoundException: Template not found : Application/admin.html 2012-02-29T00:11:53+00:00 app[web.1]: The template Application/admin.html does not exist.
/app/controllers/Application.java在第78行:
public static void admin(){
List<MailUSer> allUsers = MailUSer.findAll();
render(allUsers);
}
溃败文件:
# Home page
GET / Application.index
GET / module:secure
POST /Register/welcome Register.welcome
GET /Application/adminPage Application.admin
# Ignore favicon requests
GET /favicon.ico 404
# Map static resources from the /app/public folder to the /public path
GET /public/ staticDir:public
# Catch all
* /{controller}/{action} {controller}.{action}
我究竟做错了什么 ?
最佳答案
我在Heroku上遇到了这个问题,它是不区分大小写的。
在我的 Controller 中,我有类似
public static void showUser(Long id) {
...
render(user);
}
但是在我的views文件夹中
app/views/Application/showuser.html
在我的Mac和Windows机器上,这很好,但是在Linux机器(包括Heroku)上,找不到文件
showUser.html
。
关于exception - 在Heroku上部署时 Play Framework 应用程序 'cannot find template',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9492102/