Oh I've been looking at how this works. Django does this built in.
Thanks for the link!
Django does this by storing the state in the database, starting the main Django in a thread that can be restarted on code change [1] ; It does not keep the state in memory.