Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use production BlobStore in development server (Google App Engine)

I'm developing an application on Python Google App Engine and I'm using the BlobStore to store image data.

I've backed up all my database information to my local host to set up a local development environment but I want to use the Blobs Images from my Production server (so I don't have to copy all files to my local computer).

When I call images.get_serving_url() to get the image url it returns a local reference to it that doesn't exist (since all the images are in the prod server).

Is there a way to configure the images class to point to my prod server? If the answer is no, how can I redirect the calls from my dev server that hit /_ah/img/ to my prod server?

from google.appengine.api import images
print images.get_serving_url(page, size=100)

>> http://0.0.0.0:8080/_ah/img/AMIfv96IySWiIWF-4FRipavsn9xXnkk-EhmNOU0qWZ4y0ORIXj0Ct85C9eXMBdv3JVooWPIm6-2D3U9ffuTtpJEkWh13ZzmmaNKSiu5QMsnk0exNWj7g1OWbpNxcsjtmv52wz94QFQ6xCNz-atycTqfkdDHbX-LWmMqlsrVEs86S4wsAKSNOZZE=s100

I wish the output from this call was my prod server url.

like image 953
Victor Avatar asked Nov 01 '22 10:11

Victor


1 Answers

What you're asking isn't possible.

The image blob keys are more or less randomly generated. ie, when you upload a blob to the production Blobstore, it gets a key generated.

There's no way for the dev appserver to know the key for a given image on the production server. If you "upload" the same image to the dev_appserver, it'll get a completely different key.

Your options are either to download all the images locally and "upload" them to your local dev server. If you're using Google Cloud Storage, the gsutil tool might help: https://developers.google.com/storage/docs/gsutil

Or find all the blobstore urls on the server and manually map them in your own application.

like image 118
dragonx Avatar answered Nov 04 '22 10:11

dragonx