Open takanori-matsushita opened 4 years ago
Procfileの作成 Laravelのプロジェクトルートディレクトリに配置する
Procfile
web: vendor/bin/heroku-php-apache2 public/
heroku作成
ターミナルで以下のコマンドを入力(heroku CLI導入後)
heroku create laraveltutorial --buildpack heroku/php
APP_KEYの作成
heroku config:set APP_KEY=$(php artisan --no-ansi key:generate --show)
herokuへpushする
git push heroku master
herokuへデプロイしたページを開く
heroku open
デバッグモードを有効にする
heroku config:set APP_DEBUG=true
データベースの設定 heroku上でPostgreSQLのアドオンを追加する dashbord->app名->Resources->Add-onsでHroku postgresを検索して追加
Attribute [auth] does not exist.
laravel/uiのミドルウェアのauthが見つからないと怒られる。
対処方法
composerのrequire-devにインストールしていたので、本番環境にインストールし直す。
composer require laravel/ui
Class 'Faker\Factory' not found
クラスが見つからないと怒られる。
対処方法
Fakerは本番環境には必要ないが、今回は学習上シーディングを行いたいので、これも同様に本番環境にインストールし直す。
composer require fzaninotto/faker
その他.envで設定した環境変数を設定する。
herokuで環境変数を設定するコマンド
heroku config:set 環境変数名=値
微修正はmaster