2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

初心者が初めてrailsアプリをherokuにデプロイしてつまずいた所

Posted at

環境

Rails 5.2.3
Ruby 2.4.1

つまずいた所

背景画像が表示されない

urlimage-urlに変えたら反映されました。

 background-image:image-url('main.jpg');

assetが更新されない

 herokuは自動でprecompileしてくれるので、bundle exec rake assets:precompile RAILS_ENV=productionをする必要はありません。反対に一度このコマンドを実行すると、毎回行う必要があります。その際は作成されたpublic/assetsを削除してしまいましょう。

データベースが存在しない

当たり前ですが、本番環境用のdatabaseは違うので、migarationファイルを実行する必要があります。

$ git push heroku
$ heroku run rails db:migrate
$ heroku run rails db:seed (初期データある場合)

本番環境ではsqliteは使えない事も注意です!!

コードの変更が反映されない

単純にコミットできていなだけでした。。。
みなさんもこういう初歩的なミスに気をつけてください。

以上です。とりあえずなんとかデプロイできてよかった...

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?