Apparently Play 1.x had a command 'play secret' that would create a new application.secret, but I don't see an equivalent command in Play 2.x. It is recommended to change the key when moving from development to production, so I need to find a way to make a new key for that.
The easiest way to start an application in production mode is to use the start command from the Play console. This requires a Play installation on the server. When you run the start command, Play forks a new JVM and runs the default Netty HTTP server.
To run the tutorial: Unzip the project in a convenient location. In a command window, change to the top-level project directory. Enter sbt run .
You are right. I think this feature is not yet implemented in 2.x
version. I am afraid the only way to do is to create a new project. Each new project will generate a new secret key. And then copy only the newly generated key.
I think this issue was raised for your problem: https://github.com/n8han/giter8/issues/42 referenced in https://groups.google.com/forum/#!topic/play-framework/aMyM_fDglSs
Good luck.
EDIT 2020-01-23:
It would appear that they went back to camel-case, so on current versions of Play w/ SBT it should be
sbt playGenerateSecret
EDIT 2015-05-11:
As noted by @myk this is now implemented in the sbt plugin, you need to run:
sbt play-generate-secret
or
sbt play-update-secret
Edit 2015-07-02
Using activator:
activator playGenerateSecret
This is how you can do it in Scala console:
$ scala
scala> val r = new java.security.SecureRandom
r: java.security.SecureRandom = java.security.SecureRandom@b4ca6f6
scala> (1 to 64).map(_=>(r.nextInt(74)+48).toChar).mkString.replaceAll("\\\\+", "/")
res4: String = cCU`liU?i^R3f:Tk3ekG9a0^hjtwADUi@X2OtjAqKG`vv/>dk@cq_QOnu47WQ<0_
Your secret is key now is:
cCU`liU?i^R3f:Tk3ekG9a0^hjtwADUi@X2OtjAqKG`vv/>dk@cq_QOnu47WQ<0_
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With