Making a single connection that persists across multiple view method calls in Django?

I have a 'upload' method in views.py that gets called when the user navigates to www.website.com/upload/data. In this method, I create a connection to amazon S3 and then load the data.

But the problem is that this download method will be called hundreds of times every minute. So it would be very wasteful to create a new S3 connection every time.

I just want to create one connection that persists across all separate calls to the load method.

How should I do it?

+3


source to share


1 answer


Boto has a built-in connection pool and uses the Keep-Alive HTTP feature. So you should be fine.

Source: https://groups.google.com/d/msg/boto-users/O2cae4Rnsps/b8O53OakoSoJ



Related StackOverflow question: Boto connect_xxx method and connection pools

+3


source







All Articles