Play Framework
Deploy to Heroku
Java Version
Create a system.properties file and specify Java version.
java.runtime.version=1.8Note Heroku supports 1.8 by default.
Config
Application Secret
Run
sbt playGenerateSecretto generate a key and add inapplication.conf
# application.conf
play.http.secret.key=${?APPLICATION_SECRET}Hosts
Add allowed hosts in
application.conf
# Hosts
play.filters.hosts {
# Allow requests to example.com, its subdomains, and localhost:9000.
allowed = ["abc.herokuapp.com/", "localhost:9000"]
}In Heroku Settings, add the followings env variable under
Config VarsAPPLICATION_SECRET:some-key
Deployment
Deploying to a remote Git repository
git push heroku masterDeploying with the sbt-heroku plugin
1. Add plugin in project/plugins.sbt
addSbtPlugin("com.heroku" % "sbt-heroku" % "2.1.4")2. In build.sbt
herokuAppName in Compile := "my-heroku-app-name"3. Deploy
sbt stage deployHerokuRef: https://github.com/heroku/sbt-heroku
Troubleshooting
CSS not showing on Heroku
Run
sbt stage clean&sbt stage deployHeroku
References
Last updated
Was this helpful?