Heroku
Herokuログイン
% heroku login
Gemfile
group :development, :test do
gem 'sqlite3', '1.3.13'
特にこれ注意。
gem 'sqlite3'は普通のところから消さないとダメだよ。
group :production do
gem 'pg', '0.20.0'
end
config/database.yml
production:
<<: *default
adapter: postgresql
database: db/production.postgresql
bundle install --without production
git add .
git commit -a -m "heroku"
Herokuアプリ作成
% heroku create <アプリ名>
リモートリポジトリの確認
% git remote [18:25:22]
heroku
origin
リモートリポジトリの登録
git remote add heroku https://git.heroku.com/model-test-heroku.git
git push heroku master
heroku run rails db:migrate
もしもこんな画面になったら
これはrootに何も登録していないのが原因
config/routes.rb
root 'blogs#index'
こんな感じのやつが必要!
ローカルでいつもHello!Railsみたいなやつで放置してたのが悪かったね。
addしてなかったのが悪いのかわからないけどこれでできた。