我正在执行railsbridge installfest(作为Odin项目的一部分),我在最后阶段遇到了问题:“部署Rails应用程序”。我从终端获得了很多意想不到的结果,当我在教程结束时导航到heroku应用程序的网址时,我得到:
“您要查找的页面不存在。 您可能输错了地址或页面可能已移动。 如果您是应用程序所有者,请检查日志以获取更多信息。“
我在Windows 10上运行Ubuntu 16.04 LTS作为虚拟机。我尝试删除教程期间创建的test_app(在线和关闭)并重新启动,我尝试关闭和启动虚拟机重新开始,但没有运气。我也曾在本网站上查找过类似问题的人,但找不到任何等效的错误消息。
在出现这些问题之前,本教程让我创建了一个rails服务器,它的运行方式完全像我所说的那样。这个问题才在我尝试将应用程序部署到heroku时开始。
我已经包括了我经历的所有阶段。预期的命令行结果(在教程中指定)与我的实际结果不同,我将两者都包括在内,标记为差异。我没有包含符合预期的命令行结果 - 这个问题已经足够长了,而我没有添加所有内容!如果你需要这些信息来帮助我,我已经保存了,所以请告诉我。
道歉,如果我错过了一些明显的东西 - 我完全新编码。
我执行了(在终端):
git init
git add -A
git commit -m "initial commit"
git log
heroku create
第一次差异:
预期代码:
Enter your Heroku credentials.
Email: myemail@example.com
Password:
Uploading ssh public key /Users/smei/.ssh/id_rsa.pub
Creating floating-winter-18... done, stack is cedar
http://floating-winter-18.heroku.com/ | git@heroku.com:floating-winter-18.git
Git remote heroku added
实际代码:
Creating app... done, ⬢ tranquil-beyond-97147
https://tranquil-beyond-97147.herokuapp.com/ | https://git.heroku.com/tranquil-beyond-97147.git
然后我在
gem 'sqlite3'
到
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
然后(再次在终端)我执行了:
gem install bundler
bundle install --without production
然后我在〜/ railsbridge / test_app / config / routes.rb中添加了一行Rails.application.routes.draw下的行:
添加了一行:
root 'drinks#index'
然后(回到终端)我执行了:
git add .
git commit -m "Updates for heroku deployment"
git push heroku master
第二次差异:
预期代码:
The authenticity of host 'heroku.com (75.101.145.87)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,75.101.145.87' (RSA) to the list of known hosts.
Counting objects: 60, done.
Compressing objects: 100% (54/54), done.
Writing objects: 100% (60/60), 79.03 KiB, done.
Total 60 (delta 10), reused 0 (delta 0)
-----> Heroku receiving push
-----> Rails app detected
Compiled slug size is 080K
-----> Launching...... done
App deployed to Heroku
To git@heroku.com:floating-winter-18.git
* [new branch] master -> master
实际代码:
Counting objects: 114, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (100/100), done.
Writing objects: 100% (114/114), 25.05 KiB | 0 bytes/s, done.
Total 114 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
remote: -----> Installing dependencies using bundler 1.11.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: Fetching gem metadata from https://rubygems.org/..........
remote: Fetching version metadata from https://rubygems.org/...
remote: Fetching dependency metadata from https://rubygems.org/..
remote: Installing i18n 0.7.0
remote: Installing concurrent-ruby 1.0.2
remote: Installing rake 11.3.0
remote: Installing minitest 5.9.1
remote: Installing builder 3.2.2
remote: Installing thread_safe 0.3.5
remote: Installing mini_portile2 2.1.0
remote: Installing erubis 2.7.0
remote: Installing rack 2.0.1
remote: Installing nio4r 1.2.1 with native extensions
remote: Installing websocket-extensions 0.1.2
remote: Installing mime-types-data 3.2016.0521
remote: Installing arel 7.1.4
remote: Installing coffee-script-source 1.10.0
remote: Installing execjs 2.7.0
remote: Installing thor 0.19.1
remote: Installing multi_json 1.12.1
remote: Installing pg 0.19.0 with native extensions
remote: Installing method_source 0.8.2
remote: Installing puma 3.6.0 with native extensions
remote: Using bundler 1.11.2
remote: Installing sass 3.4.22
remote: Installing tilt 2.0.5
remote: Installing turbolinks-source 5.0.0
remote: Installing nokogiri 1.6.8.1 with native extensions
remote: Installing tzinfo 1.2.2
remote: Installing websocket-driver 0.6.4 with native extensions
remote: Installing rack-test 0.6.3
remote: Installing sprockets 3.7.0
remote: Installing mime-types 3.1
remote: Installing coffee-script 2.4.1
remote: Installing uglifier 3.0.2
remote: Installing turbolinks 5.0.1
remote: Installing activesupport 5.0.0.1
remote: Installing mail 2.6.4
remote: Installing globalid 0.3.7
remote: Installing activemodel 5.0.0.1
remote: Installing jbuilder 2.6.0
remote: Installing activejob 5.0.0.1
remote: Installing activerecord 5.0.0.1
remote: Installing loofah 2.0.3
remote: Installing rails-html-sanitizer 1.0.3
remote: Installing rails-dom-testing 2.0.1
remote: Installing actionview 5.0.0.1
remote: Installing actionpack 5.0.0.1
remote: Installing actionmailer 5.0.0.1
remote: Installing actioncable 5.0.0.1
remote: Installing railties 5.0.0.1
remote: Installing sprockets-rails 3.2.0
remote: Installing coffee-rails 4.2.1
remote: Installing rails 5.0.0.1
remote: Installing jquery-rails 4.2.1
remote: Installing sass-rails 5.0.6
remote: Bundle complete! 16 Gemfile dependencies, 53 gems now installed.
remote: Gems in the groups development and test were not installed.
remote: Bundled gems are installed into ./vendor/bundle.
remote: Bundle completed (25.91s)
remote: Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: I, [2016-10-16T22:14:51.182054 #1022] INFO -- : Writing /tmp/build_eaa9178115288d749f254409ffd66e9f/public/assets/application-ea005870b2299ed0464e134ab4079aa8856885e9ffd3d81e60417322f2fa0a97.js
remote: I, [2016-10-16T22:14:51.202261 #1022] INFO -- : Writing /tmp/build_eaa9178115288d749f254409ffd66e9f/public/assets/application-ea005870b2299ed0464e134ab4079aa8856885e9ffd3d81e60417322f2fa0a97.js.gz
remote: I, [2016-10-16T22:14:51.252933 #1022] INFO -- : Writing /tmp/build_eaa9178115288d749f254409ffd66e9f/public/assets/application-d12397cbc3a266ce5a99f7b588223090c55ca04a439953bb5f9304395de93fc3.css
remote: I, [2016-10-16T22:14:51.253116 #1022] INFO -- : Writing /tmp/build_eaa9178115288d749f254409ffd66e9f/public/assets/application-d12397cbc3a266ce5a99f7b588223090c55ca04a439953bb5f9304395de93fc3.css.gz
remote: Asset precompilation completed (3.83s)
remote: Cleaning assets
remote: Running: rake assets:clean
remote:
remote: ###### WARNING:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby '2.2.4'
remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.
remote:
remote: ###### WARNING:
remote: No Procfile detected, using the default web server.
remote: We recommend explicitly declaring how to boot your server process via a Procfile.
remote: https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> console, rake, web, worker
remote:
remote: -----> Compressing...
remote: Done: 27.9M
remote: -----> Launching...
remote: Released v5
remote: https://tranquil-beyond-97147.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/tranquil-beyond-97147.git
* [new branch] master -> master
最后,我进入了
heroku run rake db:migrate
第三次差异:
预期代码:
Migrating to CreateDrinks (20160706063236)
== 20160706063236 CreateDrinks: migrating =====================================
-- create_table(:drinks)
-> 0.0084s
== 20160706063236 CreateDrinks: migrated (0.0085s) ============================
实际代码:
Running rake db:migrate on ⬢ tranquil-beyond-97147... up, run.1313 (Free)
D, [2016-10-16T22:16:19.568857 #3] DEBUG -- : (12.1ms) CREATE TABLE "schema_migrations" ("version" character varying PRIMARY KEY)
D, [2016-10-16T22:16:19.582446 #3] DEBUG -- : (7.5ms) CREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
D, [2016-10-16T22:16:19.586398 #3] DEBUG -- : (1.8ms) SELECT pg_try_advisory_lock(4170385879066863015);
D, [2016-10-16T22:16:19.598567 #3] DEBUG -- : ActiveRecord::SchemaMigration Load (1.9ms) SELECT "schema_migrations".* FROM "schema_migrations"
I, [2016-10-16T22:16:19.604863 #3] INFO -- : Migrating to CreateDrinks (20161016221052)
D, [2016-10-16T22:16:19.607807 #3] DEBUG -- : (1.8ms) BEGIN
== 20161016221052 CreateDrinks: migrating =====================================
-- create_table(:drinks)
D, [2016-10-16T22:16:19.615754 #3] DEBUG -- : (7.0ms) CREATE TABLE "drinks" ("id" serial primary key, "name" character varying, "temperature" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
-> 0.0078s
== 20161016221052 CreateDrinks: migrated (0.0079s) ============================
D, [2016-10-16T22:16:19.623202 #3] DEBUG -- : SQL (1.9ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20161016221052"]]
D, [2016-10-16T22:16:19.627228 #3] DEBUG -- : (3.8ms) COMMIT
D, [2016-10-16T22:16:19.637096 #3] DEBUG -- : ActiveRecord::InternalMetadata Load (1.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
D, [2016-10-16T22:16:19.644393 #3] DEBUG -- : (1.6ms) BEGIN
D, [2016-10-16T22:16:19.647314 #3] DEBUG -- : SQL (1.9ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "production"], ["created_at", 2016-10-16 22:16:19 UTC], ["updated_at", 2016-10-16 22:16:19 UTC]]
D, [2016-10-16T22:16:19.649903 #3] DEBUG -- : (2.4ms) COMMIT
D, [2016-10-16T22:16:19.651778 #3] DEBUG -- : (1.7ms) SELECT pg_advisory_unlock(4170385879066863015)
我希望我尽可能清楚地表达了这一点,并且非常感谢您提供的任何帮助。
答案 0 :(得分:0)
我会说你应该检查tranquil-beyond-97147.herokuapp.com
,因为这是Heroku为你创建的应用程序的名称。
如果它没有通过,您应该运行heroku logs
并粘贴内容,错误的原因始终在日志中。