Play是否支持针对每个环境(开发,维护,生产)的单独的路由文件? [英] Does Play support separate routes files per environment - dev, uat, prod?
本文介绍了Play是否支持针对每个环境(开发,维护,生产)的单独的路由文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在开发人员模式下进行以下路由:
Is it possible to have the following routing in dev mode:
GET / controllers.Assets.at(path="/public/ui/dev", file="index.html")
GET /*file controllers.Assets.at(path="/public/ui/dev", file)
以及生产中的以下产品:
and the following in production:
GET / controllers.Assets.at(path="/public/ui/prod", file="index.html")
推荐答案
是可以的.在conf/routes
中声明您的开发路线,但在conf/prod.routes
中声明您的生产路线.然后,拥有一个生产配置文件conf/prod.conf
,并将其放入其中:
Yes it is possible. Declare your dev routes in conf/routes
, but declare your production routes in conf/prod.routes
. Then, have a production configuration file, conf/prod.conf
, and put this in it:
include "application.conf"
application.router = "prod.Routes"
现在,当您在生产环境中启动应用程序时,只需使用:
Now, when you start your application in production, simply use:
path/to/myapp/bin/myapp -Dconfig.resource=prod.conf -Dhttp.port=...
这篇关于Play是否支持针对每个环境(开发,维护,生产)的单独的路由文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文