微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

导入错误:没有名为 social_django.middleware 的模块

如何解决导入错误:没有名为 social_django.middleware 的模块

您好,我是 Python 和 Django 的新手。目前我正在尝试运行在 django 1.10.2python 2.7 中制作的项目ubuntu 16.04。该项目使用名为 python-social-auth 的模块,当我尝试运行该项目时,出现以下错误

python manage.py runserver

Unhandled exception in thread started by <function wrapper at 0x7fb7d118a758>

Traceback (most recent call last):

  File "/home/mauricio/.local/lib/python2.7/site-packages/django/utils/autoreload.py",line 228,in wrapper
    fn(*args,**kwargs)
  File "/home/mauricio/.local/lib/python2.7/site-packages/channels/management/commands/runserver.py",line 39,in inner_run
http_consumer=self.get_consumer(*args,**options),File "/home/mauricio/.local/lib/python2.7/site-packages/channels/management/commands/runserver.py",line 134,in get_consumer
    return StaticFilesConsumer()

  File "/home/mauricio/.local/lib/python2.7/site-packages/channels/handler.py",line 327,in _init_
  self.handler = self.handler_class()

  File "/home/mauricio/.local/lib/python2.7/site-packages/channels/staticfiles.py",line 18,in _init_
super(StaticFilesHandler,self).__init__()
  
File "/home/mauricio/.local/lib/python2.7/site-packages/channels/handler.py",line 177,in _init_
   
 self.load_middleware()
  
File "/home/mauricio/.local/lib/python2.7/site-packages/django/core/handlers/base.py",line 80,in load_middleware
    
middleware = import_string(middleware_path)
  
File "/home/mauricio/.local/lib/python2.7/site-packages/django/utils/module_loading.py",line 20,in import_string
   
 module = import_module(module_path)
  
File "/usr/lib/python2.7/importlib/__init__.py",line 37,in import_module
    __import__(name)

ImportError: No module named social_django.middleware

因为我已经安装了 python-social-auth 模块。 希望您能详细帮助我解决这个问题,因为正如我告诉您的,我是使用这些工具的新手。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。