Why static filename extension "htm" won't parse but instead of downloaded #240
-
|
Beta Was this translation helpful? Give feedback.
Answered by
miguelgrinberg
Jun 17, 2024
Replies: 2 comments 3 replies
-
Hello, would you like to display the contents of the .htm file as an html page in your browser? from microdot import Microdot
from microdot.jinja import Template
app = Microdot()
Template.initialize(template_dir='templates/')
@app.route('/')
def index(request):
return Template('filename.htm') Your file must be in |
Beta Was this translation helpful? Give feedback.
2 replies
-
The
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kenjican
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
send_file()
function does not recognize thehtm
extension, so it does not assign the correct content type to it. Try either using.html
, or else giving the function an explicit content type: