Rails 拒绝我的 database.yml 并附"'postgresql' database is not configured"



我已经尝试了我在互联网上看到的一切,但似乎不能让它工作。我正试着把它放在一个新项目上。这是我的数据库。yml文件:

development:
adapter: postgresql
encoding: unicode
database: timetracker_development
pool: 5
username: postgres
password:
host: localhost
test:
adapter: postgresql
encoding: unicode
database: timetracker_test
pool: 5
username: postgres
password:
host: localhost
production:
adapter: postgresql
encoding: unicode
database: timetracker_production
pool: 5
username: timetracker
password:

和错误我得到我的网页:

'postgresql' database is not configured. Available: ["development", "adapter", "encoding", "database", "pool", "username", "password", "host", "test", "production"]

我通过brew安装了postgress,然后执行了init命令,当我输入启动命令时,它说的都是"服务器启动"。这意味着它开始了还是没有开始?有人知道怎么让它工作吗?

缩进在YAML中很重要。

blah:
blah2: 1

的含义与

不同:
blah:
    blah2: 1

Yml应该是这样的:

development:
  adapter: postgresql
  encoding: unicode
  database: timetracker_development
  pool: 5
  username: postgres
  password:
  host: localhost
test:
  adapter: postgresql
  encoding: unicode
  database: timetracker_test
  pool: 5
  username: postgres
  password:
  host: localhost
production:
  adapter: postgresql
  encoding: unicode
  database: timetracker_production
  pool: 5
  username: timetracker
  password:

最新更新