I am trying to setup postgres database on heroku through play framework app but i am keep getting an error regarding my DATABASE_URL.
Stack trace: -
It seems you are mixing some Play 1 and Play 2 conventions. It appears you are using Play 2. In Play 2 the easiest way to set this up is to not use DATABASE_URL
in your application.conf
and instead just override the database config in your Procfile
:
web: target/start -Dhttp.port=$PORT -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=$DATABASE_URL
For a more detailed walk-through see my Play 2 Tutorial.
Using play 2.4, Slick 3.0.3 & postgres in Heroku it works for me the following setup that runs my sql evolution scripts:
in build.sbt:
name := """app-name"""
and add the following in libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-slick" % "1.0.1",
"com.typesafe.play" %% "play-slick-evolutions" % "1.0.1",
"com.typesafe.slick" %% "slick" % "3.0.3",
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41",
"org.slf4j" % "slf4j-nop" % "1.6.4",
in application.conf:
slick.dbs.default.driver ="slick.driver.PostgresDriver$"
slick.dbs.default.db.dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
slick.dbs.default.db.properties.driver = "org.postgresql.Driver"
and in Procfile:
web: target/universal/stage/bin/app-name -Dhttp.port=${PORT} -Dplay.evolutions.db.default.autoApply=true
Cheers