daphne and environment variables

Hello all,

One of the projects I work on is reasonably large and involves … uwsgi in emperor mode. It works great, including the ability to call ini files for other ini files for DRY, etc.

Have just upgraded to django 4.2 :slight_smile: and have been seriously thinking about a gradual move to daphne. Just for a test, to check load/speed and the like. Talking about local nginx+daphne deployment.

I mentioned ini files because they are great to do things similar to:

ini /etc/uwsgi/foo.ini
ini /etc/uwsgi/foo2.ini

host = www.foo.com
env = HOST=host
env = HOST_FULL=https://%(HOST)

etc, etc.

Now how to do that for daphne? dotenv? Something else?


When you run uwsgi in emperor mode, it’s working as a process manager. That mode isn’t doing work itself, it spawns off the vassal instances to handle the requests. (It is also able to stop, start, and restart those instances.)

So the analogue in this case may be a different process manager such as supervisord or runit, or possibly even systemd. (We use supervisord) In any case, then the ability to manage configuration files or environment variables would depend upon that process manager.