Help us understand the problem. What is going on with this article?

【Rails+PostgreSQL+Heroku】環境構築まとめ

やりたいこと

rails new で作ったアプリをheorkuでデプロイしたい。
herokuではsqliteではなくpostgresqlを使わないとダメなので、初めからその設定をしておく。
psql 12.1
Rails 5.0.7.2

railsの設定

rails new e-stat-rails --database=postgresql
rails db:create
rails db:migrate
rails server
localhost:3000で起動できているか確認。

エラー対処

【再起動して解決】connections on Unix domain socket “/tmp/.s.PGSQL.5432”?への対処

【rails】Specified 'postgresql' for database adapter, but the gem is not loaded と怒られた件

herokuへ

Herokuへデプロイした時に「The page you were looking for doesn't exist. 」エラーが出る
こうならないようにcontrollerとroutesを設定してrootでhelloworldと表示するようにする。

application_controller.rb
class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  def hello
    render html:"hello, world!"
  end
end
routes.rb
Rails.application.routes.draw do
  root 'application#hello'
end

git add .
git commit -m "hogehoge"
git push origin master
heroku create
git push heroku
heroku open

できた!!

wafuwafu13
メモ感覚で書いてます。
https://twitter.com/wafuwafu13_
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした