Static file MIME type

I have a bunch of files I'm serving as static files (the rest of the files are Django), and one of them does nothing when you put in the URL. I'm guessing it's because the server doesn't recognise the file extension 'entities' (the URL is My preference would be to recognise this as a plain text file and do nothing with it other than show it as text. How do I set that up?


Unfortunately I don't think there's any way of overriding the default MIME type for a static file. I assume renaming it isn't an option -- is the file likely to be hit particularly frequently? If not, perhaps you could serve it using Django?

The uWSGI docs talk about something called mime-file in; might that be an option? Or would that be a global change rather than just for my account?

I don't think the file will be hit all that often. I wish I could rename it, but I don't have that choice. I can look into the Django idea if the uWSGI option isn't feasible, maybe a redirect to a better file name.

Actually a redirect would be fine too if that's possible at the static file level.


We auto-generate the uWSGI configuration files from a template, so yes, unfortunately it's not something we could put in for one specific website :-(

(I'm also not 100% sure it would work quite correctly even if we did -- if I'm reading correctly, mime-file is a file to override or extend the system /etc/mime.types, which is a mapping from extensions to MIME types, so you'd only be able to say "all .entities files are text/plain" -- though maybe that would actually be what you wanted.)

I'll add a ticket to allow user-specified MIME mapping files, as it might be a useful thing for other people, but the Django route is probably the best option for now.

Thanks for the information. I did a redirect via Django to a .txt file, which seemed to be the cleanest solution.

Sounds like a great solution!