Determine some layer of your application that will be the interface. The "default assumption" in a framework like Django is that all requests will be coming in through an HTTP service - so one option is to simply communicate through that HTTP interface.
If you're concerned about having multiple threads (or http requests) updating the same object at the same time and getting interdeterminate results from the process, then you'll need to do some extra work to serialize that process. I've done this for a few items where I use the database to serialize - all the HTTP views (and some plain ole python invoking the Django frameworks) write the data into a database table, and a single external process reads from that table and does what it needs to do. Since we were using multiple application (django) servers that seemed to be about the right place for us. If you're doing everything from within a single process space (like the Django dev server, for example) you can play with adding and spawning threads to do your processing and handing data between them. Seemed like way more work than I wanted to mess with, but it's possible. -joe On 2/2/07, Dill0r <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Though there is a section in the FAQ converning diangos MVC philosphy > im still confused. > > My model is manipulated while my application runs. > So how do i manipulate the model from external? Ive written a stop/ > wait protocol in python which communicates with the microcontroller > that manipulates the data. Wherefrom do i start the protocol-threads? > views.py? > > i give u an easy example of what i want to do: > > there are 5 LEDs and 5 switches connected by a fieldbus, controlled my > a microcontroller (busmaster). > the controller is connected by rs232 to the webserver. > A database holds the states of the LEDs. > There is a template with 5 imgs, one for each LED. Imgs can be yellow > (LED on) or grey (LED off). > If i click a img, webserver informs microcontroller, LED is toggled. > > What im looking for is a place from where i can manage the model, > communicate with the microcontroller,... > According to the faq, views.py would be right place!? > Do i really have to start the protocol-threads (2 for communication, 1 > to put data in/out database) like this: > > > views.py: > > def some-url(request): > if my-threads-are-not-running: > start-my-threads > > so every client first has to request this url, to ensure the protocol > running....? > Or is there another way? > > (I do not want to put all this outside of django.) > > > > thank you for every hint :) > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---