What you essentially want is a common pattern called a "singleton": 
something that there is only one of, like "None" and "Elipsis". You can do 
something workable, but ugly, using module-level variables, but there are 
known patterns for creating singletons

Here's some starters:

http://stackoverflow.com/questions/42558/python-and-the-singleton-pattern




On Friday, December 14, 2012 9:33:19 AM UTC-8, Rafael Almeida wrote:
>
> Hello,
>
> I have a django application which needs to connect to some backend 
> services. Problem is I don't want to create a new connection everytime, but 
> to use a connection pool. One connection per thread would be fine, but I 
> don't know how to use django in order to achive that. I'd like to perhaps 
> save those connections on cache subsystem, but I don't know how to create 
> one key per thread, per worker.
>
> Thank you for your help,
> Rafael
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/t0Saic8ICZYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to