Bogdanp / django_dramatiq

A Django app that integrates with Dramatiq.
https://dramatiq.io
Other
331 stars 77 forks source link

Production Enviroment and --watch #36

Closed douglasmiranda closed 5 years ago

douglasmiranda commented 5 years ago

We shouldn't run --watch in production, that is we need to use --no-reload.

But the thing is I need to explicitly use the --no-reload otherwise it will auto reload, even in production.

https://github.com/Bogdanp/django_dramatiq/blob/v0.7.0/django_dramatiq/management/commands/rundramatiq.py#L18-L37

One thing we're used to doing is to watch for the Django settings.DEBUG and if True we auto apply the dev settings if not we go with the production/secure settings.

What do you think about that?

Bogdanp commented 5 years ago

Are you proposing that we conditionally enable/disable the watch flag based on the DEBUG setting? I feel like that would be surprising behavior to people so I'm not sure I'd be for it.

What's preventing you from explicitly passing the --no-reload flag in production? Even if you're using the same docker file for dev and prod, you should be able to overwrite the entrypoint at runtime. Alternatively, you could make the entrypoint pass additional flags to rundramatiq:

docker run someimage -- --no-reload
douglasmiranda commented 5 years ago

I see.. I don't like implicit things too. It's just common in Django world to be oriented by settings.DEBUG.

I don't mind using --no-reload, I guess I'm more of a --reload / --insecure / --development kind of a guy. xD hahaha