Python 部署到gcp应用程序引擎后无法连接到云存储
我正在appengine虚拟机上开发一个Flask应用程序。我想将文件上传到谷歌云存储,所以我使用Python 部署到gcp应用程序引擎后无法连接到云存储,python,python-3.x,google-app-engine,google-cloud-platform,google-cloud-storage,Python,Python 3.x,Google App Engine,Google Cloud Platform,Google Cloud Storage,我正在appengine虚拟机上开发一个Flask应用程序。我想将文件上传到谷歌云存储,所以我使用Storage\u client=Storage.client()连接到云存储。仅在VM中测试时,我的应用程序运行正常,没有错误。但是,在我使用gcloud app deploy部署并在部署的应用程序上测试上载功能后,它失败并返回internet500错误。日志显示了回溯,这是由于连接到云存储的代码行:storage\u client=storage.client() 具体错误是\uuuu init
Storage\u client=Storage.client()
连接到云存储。仅在VM中测试时,我的应用程序运行正常,没有错误。但是,在我使用gcloud app deploy
部署并在部署的应用程序上测试上载功能后,它失败并返回internet500
错误。日志显示了回溯,这是由于连接到云存储的代码行:storage\u client=storage.client()
具体错误是\uuuu init\uuuuu()接受2个位置参数,但在云存储库函数中给出了3个。我有这个应用程序的python 3.5,我真的不知道如何解决这个问题。任何帮助都将不胜感激
Traceback (most recent call last):
File \"/env/lib/python3.5/site-packages/flask/app.py\", line 2292, in wsgi_app
response = self.full_dispatch_request()
File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File \"/env/lib/python3.5/site-packages/flask/_compat.py\", line 35, in reraise
raise value
File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File \"/home/vmagent/app/main.py\", line 59, in select_date
generate_report(log_lists)
File \"/home/vmagent/app/main.py\", line 83, in generate_report
storage_client = storage.Client()
File \"/env/lib/python3.5/site-packages/google/cloud/storage/client.py\", line 86, in __init__
self._connection = Connection(self, client_info=client_info)
File \"/env/lib/python3.5/site-packages/google/cloud/storage/_http.py\", line 33, in __init__
super(Connection, self).__init__(client, client_info)
TypeError: __init__() takes 2 positional arguments but 3 were given
下面是我的“requirements.txt”:
您正在使用旧库。更新requirements.txt以使用当前版本
例如:
您正在使用googlecloudfirestore==0.29.0
,但当前版本是googlecloudfirestore==1.3.0
您的大多数模块都已过时,在某些情况下不兼容(并且古代库与当前库不兼容)。您使用的是旧库。更新requirements.txt以使用当前版本
例如:
您正在使用googlecloudfirestore==0.29.0
,但当前版本是googlecloudfirestore==1.3.0
您的大多数模块都已过时,在某些情况下不兼容(古代库与当前库).你能分享你的requirements.txt文件吗?Flask==1.0.2 gunicorn==19.9.0 firebase admin==2.13.0谷歌云firestore==0.29.0谷歌云存储==1.17.0 lxml==3.7.3这是谷歌云存储版本的问题吗?感谢您分享您的requirements.txt
文件?Flask==1.0.2 gunicorn==19.9.0 firebase admin==2.13.0 google cloud firestore==0.29.0 google cloud storage==1.17.0 lxml==3.7.3这是google cloud storage版本的问题吗?谢谢,我在上一次人工智能平台预测运行时1.15(谷歌云存储1.19.1)上遇到了相同的错误。@PilipenokOleg-用你的详细信息创建一个新问题。我在上一次人工智能平台预测运行时1.15(谷歌云存储1.19.1)上遇到了相同的错误。@PilipenokOleg-用你的详细信息创建一个新问题。
Flask==1.0.2
gunicorn==19.9.0
firebase-admin==2.13.0
google-cloud-firestore==0.29.0
google-cloud-storage==1.17.0
lxml==3.7.3