Skip to content Skip to sidebar Skip to footer

Django 1.7: Serve A Pdf -file (unicodedecodeerror)

I'm trying to serve a PDF file with django 1.7, and this is basically the code that 'should' work... it certainly works if I change the content_type to 'text' and download a .tex f

Solution 1:

Try opening the file using binary mode:

file = open('path/to/file/{}'.format(file_name), 'rb')

Post a Comment for "Django 1.7: Serve A Pdf -file (unicodedecodeerror)"