我正在为一个网站开发一个 python GAE 应用程序,我正在尝试进行联合登录。
根据Identity Platform 选择指南,网站的最佳解决方案似乎是Google Identity Toolkit (web)。浏览了我能找到的所有相关文档,然后转到教程,我遇到了一个问题——安装包失败,出现与cffiidentity-toolkit-python-client
库相关的 C 编译错误,类似于这个:
# python -m pip install identity-toolkit-python-client
...
gcc -pthread -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python2.7 -c src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.c -o build/temp.linux-x86_64-2.7/src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.o
src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.c:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
在为我的 linux 发行版安装了一些特定的软件包之后,我设法最终正确地安装了该软件包,但是这些失败导致了我的实际问题(教程非常通用,我找不到任何关于 GAE 限制的提示)。
从GAE python 沙箱文档中,只有纯 python代码应该存在于 GAE 应用程序中:
Python 运行环境的所有代码都必须是纯 Python,并且不包含任何 C 扩展或其他必须编译的代码。
我没有看到 GAE SDK 或其第 3 方库中包含的身份工具包,据我了解,这意味着我必须将其作为第 3 方库安装在我自己的应用程序中。但是纯 python代码限制也适用于这些库:
您可以将任何第三方库添加到您的应用程序中,只要它是在“纯 Python”(无 C 扩展)中实现的,并且在 App Engine 运行时环境中具有其他功能。
因此标题中的问题。
我错过了什么吗?
谢谢。
到目前为止,我正在使用 webapp2 和 jinja2。