美文网首页
Heroku 部署练习

Heroku 部署练习

作者: TW妖妖 | 来源:发表于2017-03-27 21:48 被阅读13次

1.让生产环境中的应用显示“hola, mundo!”

  • (1)在 ApplicationController 中添加 hello 动作
#app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  def hello
    render html: "hola, mundo!"
  end
end```
- (2) 设置根路由

config/routes.rb

Rails.application.routes.draw do
root 'application#hello'
end```

  • (3)提交
    git commit -a -m "hello"
  • (4)推送
    git push
  • (5)使用 Git 把主分支推送到 Heroku 中
    $ git push heroku master
  • (6)heroku open查看

相关文章

网友评论

      本文标题:Heroku 部署练习

      本文链接:https://www.haomeiwen.com/subject/jahdottx.html