Lee Connell wrote: > Will there be an issue using the django ORM in twisted, being an > asynchronous framework? Is there going to be threading issues i need > to be aware of?
Yes, there are issues. :-) The ORM, as the whole of Django, is synchronous code, and not aware of the async events execution model. Therefore, each call to the ORM will block the reactor. This *may* not be an issue if you use SQLite, as most calls will return "soon enough"; this is the approach used in Divmod's Axiom. However, if you use an out-of-process, networked DB server, network latency comes into play, and you'll be better off wrapping the ORM calls in deferToThread, thus using the Twisted threadpool. Sad, but such is life. :-) Another issue is integrating Django behind Twisted's web server. Again, Django is blocking code, therefore integration with web2, via WSGI, is again done using deferToThread and the threadpool. I started writing a Django-Twisted handler to avoid this, but that effort is currently suspended. -- Nicola Larosa - http://www.tekNico.net/ Itamar Shtull-Trauring: reactor.stop() is the way to go, yes. Call it when you want the program to start. Nicola Larosa: To be able to do that you would have to recall John and George from heaven, reform the Beatles, pay them a lot to compose "Stop Me Down", and use that as the sound theme. -- April 2007 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---