I had to store files which had sizes to the north of 1MB and google app engine advised that I should store them in Google Cloud Storage. The app engine BlobProperty was not suitable.
The section Using Blobstore API with Google Cloud Storage advises to use, create_upload_url function's gs_bucket_name parameter.
I tried it.
gcs_upload_url = blobstore.create_upload_url('/myupload', gs_bucket_name='bucketname.appspot.com/')
The resultant URL that I get for the POST is not /myupload
,
It goes somewhat like
<form action="http://myapp.appspot.com/_ah/upload/XXXXXXXXXXX7NNN-XXXXYYY/" method="post" enctype="multipart/form-data">
I have changed the part after /upload/, but the point is, it clearly misses creating a proper upload URL, which can be recognized by my handler.
What's the correct way to use create_upload_url with gs_bucket_name and also get the correct URL for handing the post?
Clearly the official documentation is not helpful here.
That is the correct way. The upload URL is handled by AppEngine itself: it will accept the file upload, then call your own handler directly.
The path you passed in
create_upload_url
function is success_path. See description below.The success_path is called by App Engine after the file has been uploaded into BlobStore or Google Cloud Storage.
The URL provided by this function is intended to be used as the action of your upload form. The path provided by you is something like post-upload handler.