使用 play start 和 play run 有什么区别? [英] What's the difference between using play start and play run?

查看:30
本文介绍了使用 play start 和 play run 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是播放框架 2.0.4,

I am using play framework 2.0.4,

我注意到在项目文件夹中,如果我使用 play start,服务器响应速度比通过 play run 启动的服务器更快.但是,用户无法访问使用 start 命令启动的服务器中 public 文件夹下的静态资源,所以我想知道什么是 start 默认配置更改根目录还是我需要更改最初定义为的路由:

I noticed that in the project folder, if I used play start, the server responses faster than server started via play run. However, user can not access static resources under public folder in the server started using start command, so I am wondering what's the start default configuration that changing the root directory or do I need to change routes which originally defined as:

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

推荐答案

当您想在生产模式下部署应用程序时,应该执行 play start 命令.它的响应速度更快,因为自动重新加载类其他开发支持功能默认情况下处于禁用状态.

The play start command should be executed when you want to deploy your application on production mode. It's response faster, because the auto-reloading-class and other development-supporting-features are disabled by default.

play start命令不同,play run命令最好在开发模式下执行,因为它将启用所有开发支持- 功能,如自动重新加载、eBean DDL 生成等.

Unlike play start command, the play run command is best executed on development mode because it will enable all development-supporting-feature like auto-reloading, eBean DDL generation, and so-on.

实际上,如果您在 public/javascripts/jquery-1.9.0.min.js 上有一个 javascript 文件.即使您使用 play startplay,您仍然可以访问 url http://yourdomain/assets/javascripts/jquery-1.9.0.min.js运行 因为public/* 文件被映射到/assets/*

Actually, if you have a javascript file on public/javascripts/jquery-1.9.0.min.js. You still can access to url http://yourdomain/assets/javascripts/jquery-1.9.0.min.js even if you use play start or play run because the public/* files are mapped to /assets/*

需要注意的是,play start 命令是在后台执行这个过程,而 play run 不是.

And to be noticed that the play start command is doing the process in background, while play run not.

这篇关于使用 play start 和 play run 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆