前提・実現したいこと
djangoで管理画面にログインしたいが、
管理画面のurlを入力した際にModuleNotFoundErrorが発生
発生している問題・エラーメッセージ
pythonのフレームワーク触るのは初めてなので正直右も左もわからないです
ModuleNotFoundError at /admin/login/ No module named 'allauth.accounts'
該当のソースコード
エラーのトラックバックです
Environment: Request Method: GET Request URL: http://127.0.0.1:8000/admin/login/?next=/admin/ Django Version: 2.2.2 Python Version: 3.7.2 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'diary.apps.DiaryConfig', 'accounts.apps.AccountsConfig', 'django.contrib.sites', 'allauth', 'allauth.account'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\core\handlers\exception.py" in inner 34. response = get_response(request) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\core\handlers\base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\core\handlers\base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\admin\sites.py" in login 383. **self.each_context(request), File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\admin\sites.py" in each_context 302. 'available_apps': self.get_app_list(request), File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\admin\sites.py" in get_app_list 474. app_dict = self._build_app_dict(request) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\admin\sites.py" in _build_app_dict 419. has_module_perms = model_admin.has_module_permission(request) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\admin\options.py" in has_module_permission 537. return request.user.has_module_perms(self.opts.app_label) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\auth\models.py" in has_module_perms 423. return _user_has_module_perms(self, module) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\auth\models.py" in _user_has_module_perms 193. for backend in auth.get_backends(): File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\auth\__init__.py" in get_backends 38. return _get_backends(return_tuples=False) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\auth\__init__.py" in _get_backends 27. backend = load_backend(backend_path) File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\contrib\auth\__init__.py" in load_backend 21. return import_string(path)() File "C:\Users\hoge taro\venv_private_diary\lib\site-packages\django\utils\module_loading.py" in import_string 17. module = import_module(module_path) File "C:\Users\hoge taro\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py" in import_module 127. return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>" in _gcd_import 1006. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load 983. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load_unlocked 953. <source code not available> File "<frozen importlib._bootstrap>" in _call_with_frames_removed 219. <source code not available> File "<frozen importlib._bootstrap>" in _gcd_import 1006. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load 983. <source code not available> File "<frozen importlib._bootstrap>" in _find_and_load_unlocked 965. <source code not available> Exception Type: ModuleNotFoundError at /admin/login/ Exception Value: No module named 'allauth.accounts'
試したこと
pip install django-allauthを行いました
pip show django-allauthの結果を下に記載します
Name: django-allauth Version: 0.41.0 Summary: Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication. Home-page: http://github.com/pennersr/django-allauth Author: Raymond Penners Author-email: raymond.penners@intenct.nl License: UNKNOWN Location: c:\users\hoge taro\venv_private_diary\lib\site-packages Requires: Django, python3-openid, requests-oauthlib, requests
補足情報(FW/ツールのバージョンなど)
django version 2.2.2
python version 3.7
参考文献
動かして学ぶ!Python Django開発入門(P.255の部分でエラーになりました)
著者:大高隆
URL:https://www.shoeisha.co.jp/book/detail/9784798162508
回答1件
あなたの回答
tips
プレビュー