python - ImportError: No module named social_django.middleware.in import_module __import__(name)
问题描述
您好,我正在尝试执行一个在 django 1.10.8 和 pyhon 2.7 以及 python_social_auth 库中制作的项目。当我尝试执行该项目时,出现以下错误。希望您能帮助我
manage.py runserver
Unhandled exception in thread started by <function wrapper at 0x7f4b908eb488>
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_django。您可以通过运行以下命令来验证这一点:
python manage.py 外壳
导入 social_django
出于同样的原因,这会给你一个错误。
您可以使用以下方式安装它:
pip install social-auth-app-django
推荐阅读
- docker - 我可以基于主机文件系统构建一个 docker 容器吗?
- reactjs - 如何将 svg 作为道具传递给可按压组件
- winapi - helloworld.exe 有时仅在命令行上提供输出
- java - 如何在vaadin和spring boot中开发动态多标签?
- angular - 类型错误:source.lift 不是函数
- cuda - 在“/tmp/tmpxft_0000120b_0000000-10_my_program”中未定义对“cublasCreate_v2”的引用
- javascript - 找到像@这样的特殊字符并用span或div将其包装到html标签中
- laravel - Laravel:将自定义数据添加到资源
- c++ - c++ 找到空格时将文件拆分为记录?
- c# - Cookie 未从 Asp.net 中的 Chrome 85.0.4183.121(官方构建)(64 位)中删除