2016-02-25 74 views
1

我正在使用scala介绍heroku。在我应该在本地运行应用程序的品脱(link)我得到以下错误。使用scala示例在本地运行heroku时出错

PS E:\heroku_test\scala-getting-started> heroku local web -f Procfile.windows 
forego | starting web.1 on port 5000 
web.1 | [warn] application - Logger configuration in conf files is deprecated and has no effect. Use a logback configur 
ation file instead. 
web.1 | [info] application - Creating Pool for datasource 'default' 
web.1 | [error] c.z.h.HikariConfig - when specifying driverClassName, jdbcUrl must also be specified 
web.1 | Oops, cannot start the server. 








web.1 | Configuration error: Configuration error[Cannot connect to database [default]] 
web.1 | Factory.java:62) 
web.1 | stMethod.java:53) 
web.1 | at com.google.inject.Guice.createInjector(Guice.java:96) 
web.1 | a:199) 

我怀疑这是非常简单的东西,但我找不到在谷歌的错误信息。此外,教程中的所有前面的步骤都完全按照预期进行。

编辑: 从application.conf

# Database configuration 
# ~~~~~ 
# You can declare as many datasources as you want. 
# By convention, the default datasource is named `default` 
# 
# db.default.driver=org.h2.Driver 
# db.default.url="jdbc:h2:mem:play" 
# db.default.user=sa 
# db.default.password="" 

db.default.driver=org.postgresql.Driver 
db.default.url=${?DATABASE_URL} 

Procfile.windows

web: target\universal\stage\bin\play-getting-started.bat 
+1

您可以发布在'的conf/application.conf'文件中的'db.default'条目?你可以发布你的'Procfile.windows'的内容吗? – codefinger

回答

-1

您从您的环境中缺少DATABASE_URL。你可以看到这个人db.default.url=${?DATABASE_URL}正在尝试使用它。

因此,在启动“激活器运行”或运行“heroku local web -f Procfile.windows”(或其他启动本地服务器的其他设备)之前,您需要“设置”一个指向要使用的Postgres的链接。

本工程为快速本地黑客(第一次安装的Postgres在本地,它要求你设置的Postgres用户的密码):

set DATABASE_URL=postgres://postgres:<PASSWORD>@localhost:5432/<DB_NAME> 

,这里是一个你在安装时设置,以及数据库的名称在你想使用的Postgres里面(使用psql创建一个)。

在此之后,服务器运行。