images.get_serving_url() bugs in Google App Engine Development Server
If you are testing blobstore features related to images for your Google App Engine app locally in your development server. You may notice that images.get_serving_url() did not work correctly in development server.
First issue:
key = 'YOUR-BLOB-KEY' blob_info = blobstore.BlobInfo.get(key) print images.get_serving_url(blob_info.key())
This code will output error as get_serving_url expect a string rather than key object in development server. The following code will work on both development and production server:
key = 'YOUR-BLOB-KEY' print images.get_serving_url(key)
Second issue:
The above code will run but the URL returned will not work on development server. It will return HTTP/500 Server Error if you visited the URL.
I notice it always return URL end with "%3D%3D". If you "URL-decode" it by replacing "%3D%3D" to "==", it somehow will work. So, you can do this:
print images.get_serving_url(key).replace("%3D%3D","==")
The URL returned will work on both servers. I did not use regular expression for URL decode as this seems to be enough for the moment and it is faster.









