2017-05-28 160 views
0

爲了在Python + GAE應用程序中使用Firebase進行身份驗證,我正在使用幾個Google庫。 我已經配置了以下內容requirements.txt:在Google App Engine上部署時未找到外部庫

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

這就是我輸入:

import google.auth.transport.requests 

當我運行PIP安裝,他們得到本地安裝和我沒有得到任何錯誤。

local libs screenshot


但是,當我嘗試這個應用程序部署谷歌App Engine的,所有這些外部庫得到了同樣的錯誤。 GAE找不到以下文件:

ImportError: No module named auth.transport.requests 

回答

0

您需要將庫目錄提供給google.appengine.ext.vendor.add()方法。

在與app.yaml文件相同的文件夾中創建一個名爲appengine_config.py的文件。

編輯appengine_config.py文件並將您的庫目錄提供給vendor.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

相關問題