Rails 3.1部署到Heroku错误 [英] Rails 3.1 Deployment to Heroku Error
问题描述
我正在尝试将我的应用程序部署到Heroku,之前我已经在Windows机器上完成了,现在我正在使用mac。
I'm trying to deploy my app to Heroku, I've done this before on my Windows machine, and now I am currently using a mac.
我我第一次尝试使用Postgresql。
I'm trying to use Postgresql for the first time.
我的Gemfile中有以下内容:
I have the following in my Gemfile:
gem 'pg'
编辑:
AndrewDavis-OSX:lunchbox ardavis$ rvm list
rvm rubies
=> ruby-1.9.2-p180 [ x86_64 ]
AndrewDavis-OSX:lunchbox ardavis$ heroku rake db:migrate
rake aborted!
/app/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end
App::Application.config.session_store :cookie_store, key: '_app_session'
^
(See full trace by running task with --trace)
(in /app)
如你所见,我正在运行ruby 1.9.2。而且我的英雄迁移有错误。
As you can see, I am running ruby 1.9.2. And there is the error for my heroku migration.
编辑2:
刚刚创建了一个全新的rails应用程序使用Rails 3.1.rc1。我设置gemfile包含
Just created a brand new rails app using Rails 3.1.rc1. I set the gemfile to include
group:production do
gem'therubyracer-heroku','0.8.1.pre3'
gem'pg '
end
group :production do gem 'therubyracer-heroku', '0.8.1.pre3' gem 'pg' end
我做了一个快速的git init,提交,然后'heroku创建'和'git push heroku master'。那些都工作很好。但是问题是当我尝试'heroku rake db:migrate'时。我收到与上面相同的错误。
I did a quick git init, commited, then 'heroku create' and 'git push heroku master'. Those all work just fine. However the problem is when I try 'heroku rake db:migrate'. I get the same error that you see above.
TEMP FIX EDIT:
TEMP FIX
所以...如果我更改我的配置/ initializers / session_store.rb从
So... if I change my config/initializers/session_store.rb from
App::Application.config.session_store :cookie_store, key: '_app_session'
至
App::Application.config.session_store :cookie_store, :key => '_app_session'
并从
ActionController::Base.wrap_parameters format: [:json]
to
ActionController::Base.wrap_parameters :format => [:json]
然后我可以做'heroku rake db:migrate'就好了。任何人都在意解释为什么这样做是以原始方式在本地工作的,没有任何修改冒号/散列?原来的方式是从'rails new myApp'中生成的默认值
Then I'm able to do 'heroku rake db:migrate' just fine. Anyone care to explain why this works locally the original way, without any modification of the colons/hashes? The original way is the generated default from doing 'rails new myApp'
推荐答案
需要迁移Heroku堆栈,可以运行这个命令这样做:
The Heroku stack needs to be migrated, you can run this command to do so:
heroku stack:migrate bamboo-mri-1.9.2
我在本地运行1.9.2,这就是为什么它在本地工作。但是在Heroku,它运行的是1.8.7。
I was running 1.9.2 locally, which is why it was working locally. But on Heroku, it was running 1.8.7.
这篇关于Rails 3.1部署到Heroku错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!