Hellow. Is there any way to open file in browser using Flask ? I can read the content of the file and then return this content into page using:
@app.route('/open', methods=['GET', 'POST'])
def open():
file = urllib.request.urlopen('file:///C:/app/files/file.txt')
content = file.read()
return content
instead of it I want to force browser (Google Chrome) to open this file using it's built-in functionality, because my file is not '.txt'. Usually it's '.docx', or '.pdf'. Is there flask method to implent something like this?