fix the way cookies are set, courtesy of @max107

I was unable to load the middleware as it was. This is the correct way to set django cookies according to the documentation.