Reputation: 3
Using python 3.3.5 and django 1.6.4 here.
<link rel="stylesheet" href="css/style.css" type="text/css">
On the django development server (manage.py runserver) the above css file is getting served as text/plain and the styles are not loading. Actually, all of my js files are getting served as text/plain as well, but it doesn't seem to matter for them. text/plain was verified using the debugging tools in Chrome, but it's definitely not browser-specific as the styles are not loading in ff either.
I know the css is being loaded, since I get 200/304 status messages in the server console, so it's not a static file path type issue.
Initially when I ran mimetypes.guess_type('test.css') in the python console it gave me 'text/plain' as output. I then ran mimetypes.add_type('text/css', '.css') and now mimetypes.guess_type('test.css') returns 'text/css'. The server, however, still serves the files as text/plain.
Anyone have any experience with this issue?
Upvotes: 0
Views: 730
Reputation: 353
Django server uses mimetypes
standard Python library to do that. It relates .css
extension to text/css
, but first it takes a look in system-wide storage of such relations.
HKCR\.css\Content Type
registry key./etc/mime.types
or ~/.mime.types
.Some bad-behaved software have added relation of .css
to text/plain
there.
Upvotes: 5