Python 2.7 为什么Google Cloud Storage quickstart.py可以在Google Cloud shell上运行,但不能在Google App Engine上运行?

Python 2.7 为什么Google Cloud Storage quickstart.py可以在Google Cloud shell上运行,但不能在Google App Engine上运行?,python-2.7,google-app-engine,google-cloud-storage,Python 2.7,Google App Engine,Google Cloud Storage,Google Cloud Storage quickstart.py适用于Google Cloud Shell,但不适用于Google应用程序引擎 quickstart.py def run_quickstart(): # [START storage_quickstart] # Imports the Google Cloud client library from google.cloud import storage # Instantiates a cli

Google Cloud Storage quickstart.py适用于Google Cloud Shell,但不适用于Google应用程序引擎

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()

您不能直接作为GAE应用程序运行像
quickstart.py
这样的普通python脚本。不同的工具用于不同的目的

你需要一个基本的GAE应用程序框架。您可以在中找到样例骨架