1

For example, after a user login, I need to create a socket object that connect to a server and this socket object will be used in following operations of this user(I don't want to make a new connection in each user operation). But django's handler are all function so I have nowhere to put this socket object except use global dict.

I also try request.session['sock'] = socket_obj, but it report error: "expected string or Unicode object, NoneType found".

What is the typical way to do this in django?

4

0 回答 0