Ruby on Rails在Heroku生产环境里,为何连hello world的长尾都受限?

2026-04-10 06:471阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计431个文字,预计阅读时间需要2分钟。

Ruby on Rails在Heroku生产环境里,为何连hello world的长尾都受限?

我是Rails的新手,目前正使用Cloud9中的Rails教程。我创建了一个简单的端点,在默认的ApplicationController中测试了喜爱的Hello World。这是我的控制器:ApplicationController的class ApplicationController

我是rails的新手,我目前正在使用Cloud9中的rails教程.

我做了一个简单的端点,在默认的ApplicationController中测试我可爱的Hello World.这是我的控制器:

ApplicationController的

class ApplicationController < ActionController::Base protect_from_forgery with: :exception def hello render html: "hello, world" end end

它工作得非常好:

但是当我在Heroku中部署项目时,它返回的方法不允许.

Ruby on Rails在Heroku生产环境里,为何连hello world的长尾都受限?

任何想法我做错了什么?
这是我拥有的其他重要文件

的Gemfile

source 'rubygems.org' gem 'rails', '5.1.2' gem 'puma', '3.9.1' gem 'sass-rails', '5.0.6' gem 'uglifier', '3.2.0' gem 'coffee-rails', '4.2.2' gem 'jquery-rails', '4.3.1' gem 'turbolinks', '5.0.1' gem 'jbuilder', '2.7.0' group :development, :test do gem 'sqlite3', '1.3.13' gem 'byebug', '9.0.6', platform: :mri end group :development do gem 'web-console', '3.5.1' gem 'listen', '3.0.8' gem 'spring', '2.0.2' gem 'spring-watcher-listen', '2.0.1' end group :production do gem 'pg', '0.20.0' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

路线

Rails.application.routes.draw do # For details on the DSL available within this file, see guides.rubyonrails.org/routing.html root 'application#hello' end

在我推到Heroku之前,我做了

> bundle update > bundle install --without production 感谢Max Pleaner,我意识到我正在尝试连接错误的URL …我知道,不是很聪明.问题是,当我推到Heroku时,它说:

remote:验证部署….完成.
要git.heroku.com/vast-cove-65343.git

但是,正确的URL是
rails-tutorial-hello-mauri.herokuapp.com/

我从我的Heroku帐户获得了这个,点击Open App选项.

谢谢Max

本文共计431个文字,预计阅读时间需要2分钟。

Ruby on Rails在Heroku生产环境里,为何连hello world的长尾都受限?

我是Rails的新手,目前正使用Cloud9中的Rails教程。我创建了一个简单的端点,在默认的ApplicationController中测试了喜爱的Hello World。这是我的控制器:ApplicationController的class ApplicationController

我是rails的新手,我目前正在使用Cloud9中的rails教程.

我做了一个简单的端点,在默认的ApplicationController中测试我可爱的Hello World.这是我的控制器:

ApplicationController的

class ApplicationController < ActionController::Base protect_from_forgery with: :exception def hello render html: "hello, world" end end

它工作得非常好:

但是当我在Heroku中部署项目时,它返回的方法不允许.

Ruby on Rails在Heroku生产环境里,为何连hello world的长尾都受限?

任何想法我做错了什么?
这是我拥有的其他重要文件

的Gemfile

source 'rubygems.org' gem 'rails', '5.1.2' gem 'puma', '3.9.1' gem 'sass-rails', '5.0.6' gem 'uglifier', '3.2.0' gem 'coffee-rails', '4.2.2' gem 'jquery-rails', '4.3.1' gem 'turbolinks', '5.0.1' gem 'jbuilder', '2.7.0' group :development, :test do gem 'sqlite3', '1.3.13' gem 'byebug', '9.0.6', platform: :mri end group :development do gem 'web-console', '3.5.1' gem 'listen', '3.0.8' gem 'spring', '2.0.2' gem 'spring-watcher-listen', '2.0.1' end group :production do gem 'pg', '0.20.0' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

路线

Rails.application.routes.draw do # For details on the DSL available within this file, see guides.rubyonrails.org/routing.html root 'application#hello' end

在我推到Heroku之前,我做了

> bundle update > bundle install --without production 感谢Max Pleaner,我意识到我正在尝试连接错误的URL …我知道,不是很聪明.问题是,当我推到Heroku时,它说:

remote:验证部署….完成.
要git.heroku.com/vast-cove-65343.git

但是,正确的URL是
rails-tutorial-hello-mauri.herokuapp.com/

我从我的Heroku帐户获得了这个,点击Open App选项.

谢谢Max