1

After updating from django 1.8 to 1.10.2 and working out most of the bugs locally, I get net::ERR_CONTENT_LENGTH_MISMATCH and net::ERR_EMPTY_RESPONSE when loading static files in production.

Everything works well locally when debug is True. On production, I get templates but the static files referenced in the templates fail to load.

Everything worked well in 1.8.

we are using uwsgi in production. I'm not sure what else we are using. but can find out if it is necessary.

Anyone else dealing with this? any one fixed?

Thanks.

bennywhf
  • 11
  • 3

1 Answers1

0

As of Django 1.10, it no longer strip content from Responses with HTTP204 Status Code.

The WSGI handler no longer removes content of responses from HEAD requests or responses with a status_code of 100-199, 204, or 304. Most Web servers already implement this behavior. Responses retrieved using the Django test client continue to have these “response fixes” applied.

https://docs.djangoproject.com/en/1.10/releases/1.10/#miscellaneous

My problematic code was :

return Response({}, status=status.HTTP_204_NO_CONTENT)

And I changed to :

return Response(status=status.HTTP_204_NO_CONTENT)
Raphael Riel
  • 199
  • 1
  • 8