Thursday, September 25, 2014

Adding MIME Types for Fonts in EC2 using Python



By Default EC2 does not include mime types for fonts except svg in  /etc/mime.types

So need to add them to the system

Below code example tells you how to do that in python

import mimetypes
..
mimetypes.init()
mimetypes.add_type('font/ttf', '.ttf')
mimetypes.add_type('font/opentype', '.otf')
mimetypes.add_type('application/font-woff', '.woff')
mimetypes.add_type('application/vnd.ms-fontobject', '.eot')

For more Information please visit https://docs.python.org/2/library/mimetypes.html

No comments:

Post a Comment