我從遷移到IIS GAE一個網站,我試圖batch upload a lot of images聰明的辦法。除了那個特殊的挑戰之外,我還有一個更關心我的問題。所有站點(存儲在一個DB)的內容的參考圖像這樣:引用斑點在GAE
http://myurl.com/images/some-folder/maybe-another-folder/image-name.jpg
我創建Python中一個簡單的處理程序,以提供圖片:
class ServeBlobs(blobstore_handlers.BlobstoreDownloadHandler):
def get(self, resource):
query = "where filename='%s'" % resource
blobs = blobstore.BlobInfo.gql(query).fetch(1)
self.send_blob(blob_infos[0])
和「路線'如下
('/images/(.*)', ServeBlobs)
這很好,不需要單獨的查找表。但是,我很確定hte Blob的文件名屬性不能包含'/',那麼我在上面的例子中如何處理文件夾(其中有很多)稱爲some-folder或者maybe-another-folder?
此外,幾乎可以肯定是在圖像名稱不同的文件夾,例如重疊
"/images/foldera/main.jpg"
and
"/images/folderb/main.jpg"
任何想法?