views:

75

answers:

2

One of my applications in my Django project require each request/visitor to that instance to have their own thread. This might sound confusing, so I'll describe what I'm looking to accomplish in a case based scenario, with steps:

  1. User visits application
  2. Thread starts
  3. Until the thread finishes, that user's server instance hangs
  4. Once the thread completes, a response is delivered to the user
  5. Other visitors to the site should not be affected by any other users using the application

How can I accomplish something like this? If possible, I'd like to find a lightweight solution.

+2  A: 

But why you need thread? why can't you just do whatever you want to do in django view?

If you are using servers like apache with mod-wsgi you should be able to have good control over number of process and threads , so that part shouldn't be your worry or should not be in django views.

Anurag Uniyal
Ok. My server is actually using mod_python. Does that work? How many processes can it handle?
bobthabuilda
mostly it is apache dependent e.g. read this http://httpd.apache.org/docs/2.0/mod/worker.html
Anurag Uniyal
A: 

I dread to think why you'd want to do that.

Are you sure you're not looking for session variables?

Anentropic