Heroku, 一个很受欢迎的云平台,特点是不需要配置环境,代码推送过来就完成部署了。底层系统是基于 Ubuntu 的。
Heroku, 一个很受欢迎的云平台,特点是不需要配置环境,代码推送过来就完成部署了。底层系统是基于 Ubuntu 的。
git remote -vgit remote add heroku git@heroku.com:xxx-xxx-xx.gitgit remote rm herokugit push heroku 本地欲推送的分支名:masterheroku loginheroku createheroku open (在浏览器中)heroku run rails console
heroku run rake db:migrate
heroku run rake db:drop
heroku run rake db:create
heroku run rake db:migrateheroku run rake db:seed
可以用 heroku logs 搭配 grep 命令来快速查错。
注意下面命令中的
|,这个被称为管道命令,可以这样认为将|前面的输出当作后面的输入-i: 忽略大小写
heroku logs | grep -i error (-i 不区分大小写)heroku logs grep -i -E 'belongs_to|has_many’heroku logs grep -i bootstrapgit grep -i --name-only bootstrap
Heroku can't be established

快速查错
执行 heroku logs | grep -i error ,可以快速检索出 heroku 报错的位置

ActionView::Template::Error Missing host to link to!
config/environments/production.rb 里添加下面这样一句
Rails.application.routes.default_url_options[:host] = 'myappsname.herokuapp.com'
[Heroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options(http://stackoverflow.com/questions/4114835/heroku-devise-missing-host-to-link-to-please-provide-host-parameter-or-set-d)