I have a pointer. Put nginx in front and use x-accel-redirect to serve the file. You receive many benefits like not tying up your python threads and database connections, effortless serving, range header support, perfect security, and the like.
Request goes to django who authenticates it and returns an x-accel-redirect header which is caught by nginx who serves the file directly. Are the files on the local server? On Fri, Jul 19, 2013 at 3:26 PM, Tera Byte < [email protected]> wrote: > Hello, > > I have seen this question asked at least another time here at modwsgi > group but it looks like there is no concrete answer until now (?). > > I'm streaming quite large media files from django + mod_wsgi but the > streaming terminates abruptly in an almost randomly fashion. The file in > question is about 600MB and the streaming usually terminates between 150 or > 200MB streaming progress. > > The error message that is written into the log files is the famous > "IOError: failed to write data". Nothing more is written even if I refine > the log level. > > The django application when deployed in the development server works > flawlessly. But when deployed in Apache together with mod_wsgi causes the > problem. > > I'm running mod_wsgi in "daemon process mode". The server has 4GB of total > RAM, being 3GB available during the test scenario I have isolated. > > The django application is returning an iterator like the following, where > data is a urllib2 data stream: > > class FileIterWrapper(object): > def __init__(self, data): > self.data = data > self.chunk_size = 4096 > > def next(self): > data_block = self.data.read(self.chunk_size) > if len(data_block) == 0: > raise StopIteration > else: > return data_block > > def __iter__(self): > return self > > > I really need help with this one. The streaming component of the overall > application could be easily migrated to another technology / application > server but the goal is to stick all with django and mod_wsgi. > > Any pointers? > > Thank you > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/groups/opt_out.
