On Sat, Sep 23, 2017 at 6:21 PM, Antonis Christofides
<
ant...@djangodeployment.com> wrote:
> Hello Larry,
>
> The Django development server runs in more than one thread, which is probably
> why your initialization code run twice.
>
> OTOH, it run only once on production probably because you have configured uwsgi
> to run only one process (it's possible that this is the default on single-core
> machines). However, we usually want to run at least two processes.
I have 5 uwsgi processes - I was only seeing the init code run once
because I was just sending uwsgi a reload signal. If I killed it and
restarted it I was seeing the init code run 5 times.
> Running initialization code only once per wsgi server (re)start instead of once
> per process start seems a bit strange. Why do you need this?
I had not been given all the requirements. Turns out what we need to
do should not be part of the server init, so we moved it somewhere
else.