-
Hi All, I have a django backend that, at startup, does two things:
These calls are performed in each django app's AppConfig When running django's development server, everything works as expected. However, when running through Gunicorn with multiple workers, things get a bit messy. I'd like some help in the following:
My current gunicorn service is as follows:
Appreciate some insights on this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Sounds like there is nothing in the threads dealing with external sensors/executables that require it to share process/thread context with the HTTP serving, other than managing start/stop of dependent services. Which is one of the key features of systemd, which you already use. Why have it interfere with your flexibility in controlling HTTP thread/process management, then? Wrap it inside what Django calls "management commands" and have those launched by entirely separate systemd services, declaring dependencies as needed to have systemd manage launching / stopping it. |
Beta Was this translation helpful? Give feedback.
An extra web service that you do want to reconfigure on the python side? That one sounds more like an application for using a threaded worker model in gunicorn, and setting up / tearing down the shared object from the gunicorn server hooks