2017-07-16 48 views
0

谷歌雲存儲在谷歌雲殼quickstart.py的作品,但不是在谷歌應用程序引擎爲什麼谷歌雲存儲在谷歌雲外殼,但沒有對谷歌應用程序引擎quickstart.py作品?

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

您不能直接運行像quickstart.py純python腳本作爲GAE應用程序。不同的工具用於不同的目的。

你需要一個基本的GAE應用骨架。你可以找到在Hello World code review樣本骨架。