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:
- User 开发者_StackOverflow社区visits application
- Thread starts
- Until the thread finishes, that user's server instance hangs
- Once the thread completes, a response is delivered to the user
- 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.
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.
I dread to think why you'd want to do that.
Are you sure you're not looking for session variables?
精彩评论