2017-07-16 1 views
0
Googleのクラウドシェル上では​​なく、Googleのアプリエンジン上で動作quickstart.py

GoogleのクラウドストレージなぜGoogleのクラウドストレージquickstart.pyはGoogleのクラウドシェルで動作しますが、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() 

答えて

0

あなたはGAEアプリとして直接quickstart.pyのようなプレーンなPythonスクリプトを実行することはできません。異なる目的のための異なるツール。

基本的なGAEアプリのスケルトンが必要です。サンプルスケルトンはHello World code reviewにあります。

関連する問題