Hi all,
I'm trying to build a system with a Django frontend which displays live
information from other services on the backend (eg, the one running
python - not the browser) host.
To keep my dependencies as light as possibly I'm trying to avoid import
the settings file for django and channel into the backend services. And
run those a much lighter an simple process which concentrate on their
tasks.
I can easily create an async event in the backend processes; but to
get the channels layer to respond to it; It seems that I need to create
my own thread with it own tight loop doing something like:-
def forward_sensor_to_web(sensor_gen,dj_channel):
for sensor_data in sensor_gen():
Channel(dj_channel).send(sensor_data.as_json())
Obviously this needs to be kept running and restarted if the
loop/thread raises an exception etc.
Is there any extant best practice for how to set this sort of
architecture up using channels? Can I integrate the into the channels
main Aio loop? Or is channels to the best way to go?
I'm seeking to make sure I'm not missing anything; before thing start
to get hard to change.
Anybody got any thoughts?
--
Roger Gammans <rgammans@gammascience.co.uk>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1504263403.30060.7.camel%40gammascience.co.uk.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment