本文介绍了无法将python-social-auth导入Google App Engine的django项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过pip安装了python-social-auth

I have python-social-auth installed via pip

>>> import social
>>> print social
<module 'social' from '/usr/local/lib/python2.7/dist-packages/social/__init__.pyc'>

当我尝试运行我的django项目时,它抱怨说没有名为social

When I tried to run my django project, it complains that there is no module named social

File "/media/PROJECT/project/BINGO/bingo/django/utils/importlib.py", line 35, in import_module __import__(name)
ImportError: No module named social.apps.django_app.default

删除模块在我的项目文件夹中,在本地使用,它的工作原理:

Dropping the module inside my project folder to be used locally, it works:

>>> import os
>>> print os.getcwd()
/media/PROJECT/project/BINGO/bingo
>>> import social
>>> print social
<module 'social' from 'social/__init__.pyc'>

但是,现在它的依赖关系找不到

However, now its dependencies can't be found

File "/media/PROJECT/project/BINGO/bingo/social/apps/django_app/default/models.py", line 2, in <module>
   import six
ImportError: No module named six

我有六个安装全球。如果我在本地使用六个,则另一个依赖关系 openid ,则无法找到。我想我仍然可以继续在当地添加所有的依赖项,但为什么不导入我的全局模块?

I do have six installed globally. If I use six locally, another dependency, openid, then can't be found. I guess I can still keep going and adding all dependencies locally but why aren't my global modules imported?

谢谢!

推荐答案

你真的需要阅读appengine上的文档,它是沙盒。您的项目中必须包含由sdk直接提供的所有内容(modules / libs)。所有这些都必须与你的代码一起部署。

You really need to read the doc's on appengine and it's sandbox. Everything (modules/libs) not directly provided by the sdk must be included in your project. All of these must be deployed with your code.

所以你不能使用全局安装的模块及其依赖。所有这些都需要在您的项目中存在(安装或链接)。

So you can't use the globally installed modules and their dependencies. It all needs to be present (installed or linked) in your project.

我使用virtualenv --no-site-packages安装所有模块及其依赖关系,然后使用符号链接这些位从本地站点 - 我的项目中的lib目录中。

I use virtualenv --no-site-packages to install all modules and their dependencies, then symlink these bits from the local site-packages into a lib dir in my project.

这篇关于无法将python-social-auth导入Google App Engine的django项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 00:38
查看更多