在Google App Engin上部署时找不到外部库

2024-05-29 03:28:23 发布

您现在位置:Python中文网/ 问答频道 /正文

为了在Python+GAE应用程序中与firebase进行身份验证,我使用了几个googlelibs。 我已经配置了要求.txt包括以下内容:

google-auth==1.0.1
requests==2.14.2
requests-toolbelt==0.7.1

这是我要导入的内容:

^{pr2}$

当我运行pip install时,它们确实是在本地安装的,我没有得到任何错误。在

local libs screenshot



但是当我尝试将这个应用程序部署到googleappengine时,所有这些外部lib都会得到相同的错误。GAE找不到文件:

ImportError: No module named auth.transport.requests

Tags: installpiptxtauth身份验证应用程序内容错误
1条回答
网友
1楼 · 发布于 2024-05-29 03:28:23

您需要将库目录提供给google.appengine.ext.vendor.add()方法。在

在与您的app.yaml文件相同的文件夹中创建一个名为appengine_config.py的文件。在

{cd2>提供你的目录和cd2}供应商.add()方法。在

# appengine_config.py
from google.appengine.ext import vendor

# Add any libraries installed in the "lib" folder.
vendor.add('lib')

https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27#installing_a_third-party_library

相关问题 更多 >

    热门问题