this works for me. First in the Python shell:
>>> import pymongo, gridfs
>>> db = pymongo.MongoClient().my_gridfs
>>> # Read a file I have put in the current directory.
>>> img_contents = open('image.jpg', 'rb').read()
>>> gridfs.GridFS(db).put(img_contents, filename='image.jpg')
ObjectId('52d6c182ca1ce955a9d60f57')
Then in app.py:
import gridfs
import pymongo
from bottle import route, run, template, response
connection = pymongo.MongoClient()
@route('/static/img/gridfs/<filename>')
def gridfs_img(filename):
dbname = 'my_gridfs'
db = connection[dbname]
fs = gridfs.GridFS(db)
thing = fs.get_last_version(filename=filename)
response.content_type = 'image/jpeg'
return thing
run(host='localhost', port=8080)
When I visit http://localhost:8080/static/img/gridfs/image.jpg
I see my image in the browser.
I notice you put "https://" in the example URL, are you using a Bottle plugin or a frontend server like Apache?