![](/img/trans.png)
[英]File “/usr/lib/python2.7/importlib/__init__.py”, line 37, in import_module __import__(name) ImportError: No module named django
[英]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 shell
導入 social_django
出於同樣的原因,這會給你一個錯誤。
您可以使用以下方式安裝它:
pip 安裝 social-auth-app-django
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.