LoginSignup
1
3

More than 3 years have passed since last update.

Django 認証機能がうまく反映されない

Posted at

はじめに

この記事ではDjango + Dockerでユーザー認証機能を盛り込む際に出たエラーの対処法について書いていきます。

ModuleNotFoundError: No module named 'allauth'

このエラー文にめちゃくちゃ悩まされました。
どうしたら良いのかわからずあきらめかけていましたが、対処法はいとも簡単でした...。

まず「Docker」ファイルに次のように追記してください。

Dockerfile
RUN pip install django-allauth

次に「requirements.txt」にも追記していきます。

requirements.txt
django-allauth>=0.32.0

最後にターミナルに次のように打ち込みます。

terminal
$ docker-compose build

最後にお決まりの作業をしていきます。

terminal
$ docker-compose run --rm web python3 manage.py makemigrations

$ docker-compose run --rm web python3 manage.py migrate

$ docker-compose up

これで完了です。

最後に

このエラーに何時間もかけてしまったので、同じようにつまずいている人の助けになれば幸いです。

コマンドについてはこちらにまとめておいたので、参考になれば幸いです。

Django + Dockerコマンド

1
3
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
1
3