maialithar
maialithar

Reputation: 3123

play framework: no assets in production mode

I have a strange problem. I have an app written in Play! framework 2.0.4. It uses some public assets (css/images/javascript). Everything's fine when I run it in development mode:

blus@vmblus:~/svn/blus> play
[info] Loading project definition from /home/blus/svn/blus/project/project
[info] Loading project definition from /home/blus/svn/blus/project
[info] Set current project to blus (in build file:/home/blus/svn/blus/)
       _            _
 _ __ | | __ _ _  _| |
| '_ \| |/ _' | || |_|
|  __/|_|\____|\__ (_)
|_|            |__/

play! 2.0.4, http://www.playframework.org

> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.

[blus] $ run

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on port 9000...

(Server started, use Ctrl+D to stop and go back to the console...)

Assets load in browser without any problem. But when I want to run the same app (not copied, not moved, just the same) in production mode assets are gone:

[blus] $ start 9000

(Starting server. Type Ctrl+D to exit logs, the server will remain in background)

Play server process ID is 6845
[info] play - Application started (Prod)
[info] play - Listening for HTTP on port 9000...

Firebug shows:

"NetworkError: 404 Not Found - http://vmblus:9000/assets/stylesheets/main.css"

Every needed asset is not found. How is this even possible? And what can I do to fix this?

This is part of my conf/routes:

GET /assets/*file controllers.ExternalAssets.at(path="public", file)

And this is how I call my assets in views:

<link rel="stylesheet" media="screen" href="@routes.ExternalAssets.at("stylesheets/main.css")">

I saw this question, but my paths have no //.

Upvotes: 2

Views: 1795

Answers (1)

Pere Villega
Pere Villega

Reputation: 16439

You are using controllers.ExternalAssets.at instead of controllers.Assets.at

That's most likely the reason.

Upvotes: 2

Related Questions