james
james

Reputation: 1753

Play framework app 'cannot find template' while deployed on heroku

i have written an app that runs locally with no issues

after deploying app to Heroku when trying to enter a certain page i receive the following error (taken from log):

  • 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 around line 78 :

public static void admin(){
       List<MailUSer> allUsers =  MailUSer.findAll();
        render(allUsers);
}

rout file:

# 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}

what am i doing wrong ?

Upvotes: 6

Views: 2700

Answers (2)

Gelin Luo
Gelin Luo

Reputation: 14373

try to troubleshoot using the following items:

  1. did you upload the views folder under app to the Heroku?
  2. do you have case sensitive problems in your file and directory names (say Application/admin.html is different from application/admin.html etc)? When you are in a windows platform this is okay, but when you deloy app to a linux/unix environment, this going to break your app.

BTW, MailUSer looks strange, why not MailUser ?

Upvotes: 4

Codemwnci
Codemwnci

Reputation: 54914

I had this problem on Heroku, and it was case-insensitivity.

In my controller, I had something like

public static void showUser(Long id) {
    ...
    render(user);
}

but in my views folder I had

app/views/Application/showuser.html

On my Mac, and Windows machine, this is fine, but on Linux machines, including Heroku, the file showUser.html will not be found.

Upvotes: 9

Related Questions