我刚刚从UI加载了Play
Java Seed,创建了一个新的应用程序.我在public / stylesheets / main.css中编写了一些CSS代码,这是我对这个项目的唯一改变.编译并运行应用程序后,Chrome控制台说
GET http://localhost:9000/assets/stylesheets/main.css 404 (Not Found) GET http://localhost:9000/assets/javascripts/hello.js 404 (Not Found)
我已经阅读了资产控制器文档here,但无法弄清楚我在哪里出错.
在我的main.scala.html文件(不变从种子),我有:
<head> <title>@title</title> <link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")"> <link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")"> <script src="@routes.Assets.at("javascripts/hello.js")" type="text/javascript"></script> </head>
在我的路线文件(也从种子不变):
# Map static resources from the /public folder to the /assets URL path GET /assets/*file controllers.Assets.at(path="/public",file)
该图标显示在标签中,但是当我转到http:// localhost:9000 / assets / images / favicon.png时,页面也不可用,就像main.css和hello.js脚本一样.