简体   繁体   English

无法将python-social-auth导入Google App Engine的django项目

[英]Cannot import python-social-auth into Google App Engine's django project

I have python-social-auth installed via pip 我通过pip安装了python-social-auth

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

When I tried to run my django project, it complains that there is no module named social 当我试图运行我的django项目时,它抱怨没有名为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

I do have six installed globally. 我确实在全球安装了六个。 If I use six locally, another dependency, openid , then can't be found. 如果我在本地使用六个,另一个依赖, openid ,则无法找到。 I guess I can still keep going and adding all dependencies locally but why aren't my global modules imported? 我想我仍然可以继续在本地添加所有依赖项,但为什么不导入我的全局模块?

Thanks! 谢谢!

You really need to read the doc's on appengine and it's sandbox. 你真的需要阅读关于appengine的文档和沙盒。 Everything (modules/libs) not directly provided by the sdk must be included in your project. 不是由sdk直接提供的所有内容(模块/库)必须包含在您的项目中。 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. 这一切都需要在您的项目中存在(安装或链接)。

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. 我使用virtualenv --no-site-packages来安装所有模块及其依赖项,然后将这些位从本地站点包中符号链接到我的项目中的lib目录。

I only found the openid and six dependencies. 我只找到了openid和六个依赖项。 Actually, couldn't get the six.py to install globally for some reason, so just dumped a copy into each required directory. 实际上,由于某种原因无法让six.py全局安装,所以只需将副本转储到每个必需的目录中。 Also, ran into an issue with basestring conversion if PY2 which then lead to the default import json silently failing, so had to swap to 'simplejson'. 此外,如果PY2然后导致默认导入json无声地失败,则遇到basetring转换的问题,因此不得不交换到'simplejson'。 But in the end, got it working. 但最终,让它运作起来。

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

相关问题 在Google App Engine上使用python-social-auth进行的Google OAuth2身份验证失败 - Google OAuth2 authentication using python-social-auth on Google App Engine failed 无法运行python-social-auth示例django app - can't run the python-social-auth example django app 带有django错误的python-social-auth“没有这样的表:app_customuser” - python-social-auth with django errors with “no such table: app_customuser” Python-Social-Auth在mongoEngine(Django)上失败 - Python-Social-Auth fails with mongoEngine (Django) python-social-auth +移动应用 - python-social-auth + mobile app 使用python-social-auth的django社交认证错误 - django social authentication error using python-social-auth 使用&#39;hd&#39;param(Django / python-social-auth)限制对某个域的Google OAuth访问权限 - Limit Google OAuth access to one domain using 'hd' param (Django / python-social-auth) 如何使用Python-Social-auth和Django检索Facebook好友的信息 - How to retrieve Facebook friend's information with Python-Social-auth and Django 使用python-social-auth将Django 1.6迁移到Django 1.10时出错 - Error migrating Django 1.6 to Django 1.10 with python-social-auth HTTPError 403(Forbidden),Django和python-social-auth通过OAuth2连接到Google - HTTPError 403 (Forbidden) with Django and python-social-auth connecting to Google with OAuth2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM