import os
filename = 'C:/test/media/blog_images/2013/06/15/yay.gif'
blog_images = 'C:/test/media/blog_images/'
os.path.relpath(filename, blog_images)
How to get relative path of files from defined root directory?