0
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 3 years have passed since last update.

DjangoでHerokuデプロイ後にローカル環境で出るエラー

Posted at

エラー内容

アプリをHerokuにデプロイしたのちにローカルで修正を加えようとしたところ以下のエラーが出でしまいました。settings.pyを修正したらエラーが解消されたので、メモ。

(エラー文)
django.core.exceptions.ImproperlyConfigured: WSGI application 'myapp.wsgi.application' could not be loaded; Error importing module.

対処法

ぐぐると、wsgi.pyから Whitenoise関連の行を削除して以下をsettings.pyに追加と出てきます。

    'whitenoise.middleware.WhiteNoiseMiddleware',
    'django.middleware.security.SecurityMiddleware',

(参考)https://stackoverflow.com/questions/47624099/django-error-myproject-wsgi-application-could-not-be-loaded

上記実行しても同じエラーが出続けてましたが、settings.pyから以下3行を削除したらうまくいきました。

    # 'whitenoise.middleware.WhiteNoiseMiddleware',
    # WSGI_APPLICATION = 'mappi.wsgi.application'

DjangoとHerokuの中の動きはあまりわかってないのですが、WSGIはWebサーバとWebアプリケーションの実装に関係しているようだったので、ローカルで動かしたければこの辺は使用しなくていいのかな、、ということでコメントアウトしました。
この辺りの認識違うよとか、こうだよとかありましたらコメントくださると嬉しいです。

0
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
0
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?