子项目中的资产路由

时间:2013-04-11 16:23:13

标签: playframework playframework-2.1

我正在尝试使用play-framework创建一个admin子项目。在管理员电话http://localhost:9000/admin/index中,我无法访问管理员视图,资产存在问题。无法弄清楚出了什么问题:

val appDependencies = Seq(
// Add your project dependencies here,
javaCore,
javaJdbc,
javaEbean)

  // admin module
  val admin = play.Project(appName + "-admin", appVersion, appDependencies, path = file("modules/admin"))

  val main = play.Project(appName, appVersion, appDependencies, path = file(".")).settings( 
  // Add your own project settings here      
  ).dependsOn(admin).aggregate(admin)

项目结构如下:

.
|-app
|---controllers
|---views
|-conf
|-logs
|-modules
|---admin
|-----app
|-------controllers
|---------admin
|-------views
|---------admin
|-----conf
|-----public
|-----test
|-project
|-public
|---images
|---javascripts
|---stylesheets
|-test

CONF /路由

    GET     /                           controllers.Application.index()

    ->  /admin admin.Routes

    # Map static resources from the /public folder to the /assets URL path
    GET     /assets/*file               controllers.Assets.at(path="/public", file)

/modules/admin/conf/admin.routes

    GET     /index                           controllers.admin.Application.index()

    # Map static resources from the /public folder to the /assets URL path
    #GET     /assets/*file               controllers.admin.Assets.at(path="/public", file)
    GET     /assets/*file               controllers.Assets.at(path="/public", file)

admin.routes中的GET /assets/*file controllers.admin.Assets.at(path="/public", file)不适用于此:{{1}}

1 个答案:

答案 0 :(得分:0)

实际上,管理员中的GET /assets/*file controllers.admin.Assets.at(path="/public", file)不一定是管理员中的/assets/*file controllers.Assets.at(path="/public", file)

但是需要将观点称为不同观点。例如viewsadmin(views / admin /不起作用)