Reputation: 93773
I'd like to know if a request is HTML, CSS, image etc (in middleware).
I've tried:
print request.META['CONTENT_TYPE']
but that gives me:
text/plain
for everything, CSS and images alike.
Any advice?
Thanks!
Upvotes: 2
Views: 580
Reputation: 1514
Assuming you're using process_response, as Issac mentioned, you need to be looking at response.
Upvotes: 0
Reputation: 6359
I think you need to only be serving text based things through Django. Static media should be served through your production server. See this part of the docs
Secondly, you probably want to be checking the response, not the request.
Upvotes: 1