Are there any known issues with django and multithreading?
I need to d开发者_C百科evelop an app that runs side by side with a django-app. This will be the first time i develop a multithreaded app that runs next to a django-app so are there any 'gotchas' and 'traps' i should be aware of?
Generally, your Django app already is multi-threaded. That's the way most of the standard Django servers operate -- they can tolerate multiple WSGI threads sending requests to them.
Further, you'll almost always have Django running under Apache, which is also multi-threaded.
If you use mod_wsgi
, then Django may be part of the Apache process or a separate process.
Anything that is running "side-by-side" (Whatever that means) will be outside Apache, outside Django, and in a separate process.
So any multi-threading considerations don't apply between your Apache process (which contains Django) and your other process.
What do you mean side by side with a django-app? Could you please elaborate a bit on what you are you planning to achieve? Then helping out/answering should be easier.
Answer on OP's 1st edit
Ah. Okey. I have encountered such an application which does exactly the thing you want. It's called feedjack and you can found it http://www.feedjack.org . I had tried to do something similar. Generally, I think you would be okey with such a case (separate process using Django's ORM to populate the DB with data). At least, I had not such problems when I was using their script along with a similar django app of mine.
If you want to expose your django-app to some external software, you need to create an API for your application.
You should look at REST http://code.google.com/p/django-rest-interface/ and XMLRPC http://code.google.com/p/django-xmlrpc/
The multi-threaded nature of the external app is not a problem for django served by a production webserver (Apache for example) because by design django is able to serve many requests in parrallel
I hope it helps
精彩评论