たなしょのメモ

日々勉強していることをつらつらと

2018/11/26

Herokuへデプロイはつづく

次に各種DBの設定をしてみます。

php -r 'preg_match("/^postgres:\/\/(.+?):(.+?)@(.+?):(.+?)\/(.*?)$/", `heroku config:get DATABASE_URL`, $matches); `heroku config:set DB_CONNECTION=pgsql DB_HOST=$matches[3] DB_PORT=$matches[4] DB_DATABASE=$matches[5] DB_USERNAME=$matches[1] DB_PASSWORD=$matches[2]`;'
Setting DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD and restarting oyotoru-kun... done, v6

これも無事に完了。次はheroku環境にマイグレーションをします。

heroku run 'php artisan migrate'
Running php artisan migrate on ⬢ oyotoru-kun... up, run.6681 (Free)
**************************************
* Application In Production! *
**************************************

Do you really wish to run this command? (yes/no) [no]:
> yes

Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_11_11_145714_create_study_table
Migrated: 2018_11_11_145714_create_study_table
Migrating: 2018_11_13_220022_create_studies_table
Migrated: 2018_11_13_220022_create_studies_table

無事にテーブルができました。

config/database.phpを直すのを忘れずに。

default' => env('DB_CONNECTION', 'pgsql'),

postgreとの接続も確認できました。

f:id:bonashochang:20181127001213p:plain

 

これで画面がでるはずです!

f:id:bonashochang:20181127001627p:plain

エラーですね。。。原因を探しましょう。

laravelをデバッグモードにしましょう。

/config/app.phpを少しいじります。

'debug' => env('APP_DEBUG', true),

これでlaravelをデバッグモードにしました。

f:id:bonashochang:20181127002109p:plain

 もしやheroku内のファイルに.envがないのが原因なのでは?

今日はここまで!ではでは