我一直在玩空間,並且不能在我的生活中使用我的Heroku應用程序來遷移數據庫。我不斷收到Heroku vs YAML - 有效的YAML不被Heroku閱讀
rake aborted!
YAML syntax error occurred while parsing /app/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): did not find expected key while parsing a block mapping at line 62 column 3
這將是所有罰款和花花公子的錯誤,除了我已經經歷了三個不同的驗證器運行我的YAML文件,並通過所有的人都被告知,他們是「有效」。
這裏的編輯 YAML問題
# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
default: &default
adapter: postgresql
encoding: unicode
pool: 5
development:
<<: *default
database: coder-app_title
username: postgres
password: 123456
host: localhost
username: personal_username
password: personal_password
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default [[<< This is line 62.]]
database: coder-add_title_test
username: postgres
password: 123456
host: localhost
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="postgres://myuser:[email protected]/somedatabase"
#
# You can use this database configuration with:
#
production:
url: <%= ENV['DATABASE_URL'] %>
#
production:
線是不是你標記的代碼行,但不是文件的最後一行。 –
刪除文件末尾的'production:'部分。你不需要它們。 Heroku在post commit hook中將生產數據庫設置寫入'database.yml'中。 – max
您應該考慮使用環境變量「DATABASE_URL」而不是推送數據庫配置。 – Arthur