I would like a separate process to when django starts - is there an accepted way of doing this?

StackOverflow https://stackoverflow.com/questions/542980

  •  23-08-2019
  •  | 
  •  

Question

I was thinking of making settings.py start the process but this seemed slightly ugly.

I don't really want to make make custom start up scripts, nor can I really make the starting of this process lazy.

Was it helpful?

Solution

You might be able to register a listener to the "class-prepared" signal on one of your model classes and fire your process from there. However, I think the need to do this is most likely a design smell, or a case of the tail wagging the dog.

http://docs.djangoproject.com/en/dev/ref/signals/#class-prepared

I'd be curious to know why your design calls for this, but that may get us off-topic here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top