Google云端存储quickstart.py适用于Google Cloud Shell但不适用于Google App Engine
quickstart.py
def run_quickstart():
# [START storage_quickstart]
# Imports the Google Cloud client library
from google.cloud import storage
# Instantiates a client
storage_client = storage.Client()
bucket_name = 'mygoolgeappproject.appspot.com'
bucket = storage_client.get_bucket(bucket_name)
blobs = bucket.list_blobs()`enter code here`
for blob in blobs:
print(blob.name)
# The name for the new bucket
#bucket_name = 'mygoolgeappproject.appspot.com'
# Creates the new bucket
#bucket = storage_client.create_bucket(bucket_name)
#print('Bucket {} created.'.format(bucket.name))
# [END storage_quickstart]
if __name__ == '__main__':
run_quickstart()
答案 0 :(得分:0)
您无法直接将quickstart.py
这样的普通python脚本作为GAE应用运行。用于不同目的的不同工具。
您需要一个基本的GAE应用程序框架。您可以在Hello World code review中找到示例骨架。