前提・実現したいこと
環境:pycharm
ライブラリ:Django2.2.2
Djangoで動的なWebサイトを作成しています。
その中で、マイグレーションを行うためにPycharmのRunメニューを編集しています。
いちいち、仮想環境で
(venv_private_diary)$python manage.py makemigration (venv_private_diary)$python manage.py migrate
を実行するのが不便だからです。
Runメニューを編集後、makemigrationを実行すると以下のようなエラーが出てきました。
Traceback (most recent call last): File "/Users/ilovephys/Desktop/venv_private_diary/bin/private_diary/manage.py", line 21, in <module> main() File "/Users/ilovephys/Desktop/venv_private_diary/bin/private_diary/manage.py", line 17, in main execute_from_command_line(sys.argv) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/management/base.py", line 366, in execute self.check() File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/management/base.py", line 395, in check include_deployment_checks=include_deployment_checks, File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/management/base.py", line 382, in _run_checks return checks.run_checks(**kwargs) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces url_patterns = getattr(resolver, 'url_patterns', []) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/urls/resolvers.py", line 588, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/urls/resolvers.py", line 581, in urlconf_module return import_module(self.urlconf_name) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/ilovephys/Desktop/venv_private_diary/bin/private_diary/private_diary/urls.py", line 22, in <module> path('accounts/', include("allauth.urls")), File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/site-packages/django/urls/conf.py", line 34, in include urlconf_module = import_module(urlconf_module) File "/Users/ilovephys/.pyenv/versions/3.6.5/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/ilovephys/.local/lib/python3.6/site-packages/allauth/urls.py", line 5, in <module> from allauth.django_utils.admin import * File "/Users/ilovephys/.local/lib/python3.6/site-packages/allauth/django_utils/admin.py", line 5, in <module> from django.shortcuts import render_to_response ImportError: cannot import name 'render_to_response'
長いエラー文の最後に
from django.shortcuts import render_to_response ImportError: cannot import name 'render_to_response'
と出てきます。しかし、render_to_responseがimportされているファイル「python3.6/site-packages/allauth/urls.py」は今まで触ったこともないファイルですので、エラーになる理由が全くわかりません。
試したこと
ひとまず、エラー文で出てきたファイルは一つひとつ辿り自分が編集した範囲でミスがないか確認を行いました。
その中には自分が編集しゅたことのあるファイルは一つも含まれていませんでした。
助けて下さい!!
お忙しい中恐縮ですが、皆様の知恵を借りれたらなと思っております。
どうぞよろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。