2

使用 PostgreSQL 作为 Yesod 的持久解决方案时,我似乎遇到了问题。

我按照“五分钟内Yesod”指南中的步骤进行操作。

我使用脚手架创建了一个项目。选择选项 t 时,一切顺利,我可以在以下位置看到应用程序:http://localhost:3000.

但是,当我选择 PostgreSQL 作为数据库时,输入“yesod devel”命令后出现以下错误

Registering FirstYesod-0.0.0...
Starting development server...
Starting devel application
devel.hs: InvalidYaml (Just "YamlException \"Yaml file not found: config/postgres.yml\"")
Devel application launched, listening on port 3000
Exit code: ExitFailure 11

这个 Yaml 文件是我应该添加的,还是安装过程应该提供的?如果是这样,有人知道为什么没有创建它吗?

我使用 PostgreSQL 8.4.9。它适用于 psql 和 PGAdmin III

4

1 回答 1

2

如果您看一下,您会看到生成yml的文件和打开的文件具有不同的名称:

devel.hs: InvalidYaml (Just "YamlException \"Yaml file not found: config/postgres.yml\"")

和:

$ ls config
favicon.ico  models  postgresql.yml  routes  settings.yml

所以只需复制(或移动)文件:

$ cp config/postgresql.yml config/postgres.yml

现在你得到一个新的 postgresql 特定错误:

devel.hs: SqlError {seState = "", seNativeError = 1, seErrorMsg = "connectPostgreSQL: FATAL:  password authentication failed for user \"B\"\nFATAL:  password authentication failed for user \"B\"\n"}

我不是数据库人,但如果知道这个问题的答案(就运行后要键入的命令而言psql),那么我全神贯注 ;-)。

于 2011-10-26T22:11:03.467 回答