【问题标题】:python-social-auth with Django: ImportError: No module named 'social_django'python-social-auth with Django: ImportError: No module named 'social_django'
【发布时间】:2017-05-28 20:26:13
【问题描述】:

已安装所有软件包!! 你好,我用的是python 3.5 Django==1.10 我安装了Python-social-auth 执行命令Python manage.py transfer error收到!

Traceback (most recent call last):
File "manage.py", line 22, in 
execute_from_command_line(sys.argv)
File "/home/berluskuni/web_project/exprender/.exprender/lib64/python3.5/site-packages/django
/core/management/init.py", line 367, in execute_from_command_line
utility.execute()
File "/home/berluskuni/web_project/exprender/.exprender/lib64/python3.5/site-packages/django/core/management/init.py", line 341, in execute
django.setup()
File "/home/berluskuni/web_project/exprender/.exprender/lib64/python3.5/site-packages/django/init.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/berluskuni/web_project/exprender/.exprender/lib64/python3.5/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/berluskuni/web_project/exprender/.exprender/lib64/python3.5/site-packages/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib64/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 665, in exec_module
File "", line 222, in _call_with_frames_removed
File "/home/berluskuni/web_project/exprender/.exprender/lib64/python3.5/site-packages/social/apps/django_app/default/models.py", line 1, in 
from social_django.models import AbstractUserSocialAuth, UserSocialAuth, Nonce, Association, Code, DjangoStorage
ImportError: No module named 'social_django'

【问题讨论】:

    标签: django python-3.x python-social-auth


    【解决方案1】:

    要将 Django 与 python social auth 一起使用,您还需要安装 Django 应用程序。

    安装python-social-auth时可以指定要安装Django的额外要求:

    pip install python-social-auth[django]
    

    或者,在这种情况下,您可以单独安装缺少的软件包:

    pip install social-auth-app-django
    

    【讨论】:

    • 成功安装 social-auth-app-django-0.1.0, python manage.py migrate, ImportError: No module named 'social_auth'
    【解决方案2】:

    安装时使用pip install python-social-auth[django] 而不是pip install python-social-auth


    我有 首先完成安装 pip install python-social-auth

    运行

    错误:没有名为“social_django”的模块

    然后我安装

    pip install python-social-auth[django]
    

    运行

    要执行的操作: 应用所有迁移:admin、auth、contenttypes、music、sessions、social_django 运行迁移: 正在应用 social_django.0001_initial... 好的 应用 social_django.0002_add_related_name... 好的 应用 social_django.0003_alter_email_max_length... 好的 正在应用 social_django.0004_auto_20160423_0400... 好的 正在应用 social_django.0005_auto_20160727_2333... 好的 正在应用 social_django.0006_partial... 好的


    运行迁移:

    寻求额外支持

    从 python-social-auth 迁移到拆分社交

    enter link description here

    【讨论】:

      【解决方案3】:

      也许你应该使用 pip 3:

      pip3 install social-auth-app-django
      

      【讨论】:

        【解决方案4】:

        如果你和我一样在使用 pipenv,别忘了进入 shell 然后安装(我忘了这样做,导致类似的错误):

        pipenv shell
        pipenv install python-social-auth-app-django
        

        然后添加 social_django 以安装应用程序

        我知道这不是最初的问题,但希望它有所帮助。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-09-11
          • 2015-09-10
          • 2011-04-08
          • 2016-08-09
          • 1970-01-01
          相关资源
          最近更新 更多