简体   繁体   English

Django:ImportError:没有名为social.apps.django_app的模块

[英]Django: ImportError: No module named social.apps.django_app

I had an application that I created in Windows 7, and it worked perfectly. 我有一个我在Windows 7中创建的应用程序,它运行得很好。 A few days back, I migrated to Ubuntu and copied the project file in Ubuntu. 几天前,我迁移到Ubuntu并在Ubuntu中复制了项目文件。 Now, when I try running the project using python manage.py runserver , I get the following error: 现在,当我尝试使用python manage.py runserver运行项目时,我收到以下错误:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 112, in create
    mod = import_module(mod_path)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named social.apps.django_app

What seems to be wrong here? 这里看起来有什么不对? I'm new to Ubuntu, so any help would be appreciated. 我是Ubuntu的新手,所以任何帮助都会受到赞赏。 I have the same version of Python and Django installed in Ubuntu that I had in Windows as well. 我在Ubuntu中安装了与在Windows中安装的相同版本的Python和Django。

It looks like you need to install a module on your ubuntu machine that already exists on your windows 7 environment. 看起来你需要在你的windows 7环境中已经存在的ubuntu机器上安装一个模块。 If you have pip installed, try this on Windows & Ubuntu, and look for missing packages 如果您安装了pip,请在Windows和Ubuntu上尝试此操作,并查找缺少的软件包

pip freeze

You will see something on your windows environment that is missing on Ubuntu, like python-social-auth -- your fix will be do something like on Ubuntu: 您将在Windows环境中看到Ubuntu上缺少的内容,例如python-social-auth - 您的修复将在Ubuntu上执行类似操作:

pip install python-social-auth

or 要么

sudo pip install python-social-auth

Do you use virtual environment for your project? 您是否为项目使用虚拟环境? if so, be sure that you have activated it before installing your project dependencies, use pip freeze inside your virtual env. 如果是这样,请确保在安装项目依赖项之前已激活它,在虚拟环境中使用pip freeze to see the installed packages, if you do not use it, simple pip install python-social-auth should normaly resolve your problem. 要查看已安装的软件包,如果不使用它,简单的pip install python-social-auth应该正常解决您的问题。

For me, I can see the following list of installed packages inside my virtual environment (using Ubuntu 14.04 and Python 2.7.6): 对我来说,我可以在我的虚拟环境中看到以下已安装软件包列表(使用Ubuntu 14.04和Python 2.7.6):

(venv)root@ubuntu:/home/ubuntu/test-auth# pip install python-social-auth
(venv)root@ubuntu:/home/ubuntu/test-auth# pip freeze
PyJWT==1.4.0
argparse==1.2.1
oauthlib==1.0.1
python-openid==2.2.5
python-social-auth==0.2.12
requests==2.7.0
requests-oauthlib==0.5.0
six==1.9.0
wsgiref==0.1.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM