Play Framework

Deploy to Heroku

Java Version

Create a system.properties file and specify Java version.

java.runtime.version=1.8

Note Heroku supports 1.8 by default.

Config

Application Secret

  • Run sbt playGenerateSecret to generate a key and add in application.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"]
}

Deployment

Deploying to a remote Git repository

git push heroku master

Deploying 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 deployHeroku

Ref: https://github.com/heroku/sbt-heroku

Troubleshooting

CSS not showing on Heroku

References

Last updated

Was this helpful?