Can you add a note regarding django_view?
- Lingua principale
- Python
- Stelle
- 50
- Fork
- 3
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I recently used django-wsgi to integrate some existing WSGI based code into one of my projects.
For the most part using django_view to call the WSGI app worked out well, but I noticed in certain situations I wouldn't get a response body. Ultimately the problem was discovered to be certain middleware applications examine HTTPResponse.content, which in turn would result in the iterator created in django_view being exhausted. The end result was a HTTPResponse without content.
From what I know about WSGI, which isn't much, using iterators/generators in the response is perfectly acceptable. In this case care must be taking to ensure that the response isn't iterated until it's going to be sent to the client, otherwise you could end up with a partial or empty response body.
I worked around it by doing a cheesy response.content = response.content since I don't have huge amounts of data involved.
I don't consider it a bug technically, but having a note/warning might prevent someone else from going crazy in the future. =)
Thanks,
Chad
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.