Skip to content
Discussion options

You must be logged in to vote

I apologize for this. Reviewing the docs I do see how this can be difficult to figure out.

The default content type that Microdot uses in responses is text/plain. This is used for any responses that do not included an explicit content type. The send_file function uses the file extension to define the content type, so those work automatically, but for templates the file extension isn't reliable (some people use .tpl for example) so it isn't used.

You have two options. Either you explicitly give a content type:

return Template("admin/admin.html").render(psks=psks), {"Content-Type": "text/html"}

or else you configure HTML as a default content type at the top of the file:

from microdot import R…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@agieocean
Comment options

Answer selected by agieocean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants