Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @blueprint.route("/<path_hash>/<filename>")
- def static_file(path_hash, filename ):
- article = db.session.query(xx.xxx.xx)
- path_hash_config = URLSafeSerializer('this is secret', salt='pocoo fans')
- # article[1][7] -> returning email
- path_hash = path_hash_config.dumps(article[1][7])
- path_unhash = path_hash_config.loads(path_hash_config.dumps(article[1][7]))
- # article[1][3] -> get file relative path ex: guido@gmail.com/images/writings/sssss.jpg
- #filename variable to get the filename so "guido@gmail.com/images/writings/a.jpg" returning a.jpg
- filename = article[1][3].split('/')[3]
- file_location = path_unhash + '/' + filename
- # return send_from_directory(static_folder, path_unhash)
- # return send_from_directory(static_folder, request.path[1:])
- return send_from_directory(static_folder, file_location)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement