2010-10-14 47 views
0

我想用Heroku首次在Rails上部署我的應用程序。Elementary Rails部署

我花了相當多的時間,但在某個地方還是有差距的。

混帳:創建私人回購,推到Git的成功
的Heroku:創建免費的應用程序,併成功地推(但應用 '崩潰')
地方:

rake db:schema:dump #success 
rake db:schema:load RAILS_ENV=production #failure: production database is not configured 
rake db:create db:load RAILS_ENV=production #failure: undefined method '[]' for nil:NilClass 
    active_record/railties/databases.rake:59:in 'rescue in create_database' 
    active_record/railties/databases.rake:39:in 'create_database' 

我的database.yml文件:

defaults: &defaults
adapter: mysql
username: root
password: password
host: localhost

development:
<<: *defaults
database: project_dev

test:
<<: *defaults
database: project_test


只是說:
production: <<: *defaults database: project_production

我可以做一個總新手的錯誤。你知道我可能會出錯嗎?

+3

你的database.yml中的生產環境在哪裏? – hellvinz 2010-10-14 21:48:15

+0

哈!談論一個菜鳥的錯誤。我正在通過這個和下面的建議。讓我們看看它去了哪裏。 – sscirrus 2010-10-14 22:14:15

回答

1

使用命令heroku rake db:schema:load,它只是在Heroku的環境中執行命令rake db:schema:load

您不需要擔心數據庫環境是否由Heroku在編譯slug時自動配置。

0

您正在運行的rake命令在您的開發機器上運行。如果你想在服務器上運行耙命令,使用Heroku的命令(例如):

heroku rake db:create 

注意,如果你要推的數據,你就錯了。轉到heroku.com並查看那裏的文檔。