Code review comment for lp:~facundo/magicicada-server/better-settings-local

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Hum, I really really don't like the fix_settings function. But if you feel very strong about it, could you please at least call it "override_settings"?

For needs like this, what I would propose is using a more "traditional" approach with env vars. Something like:

* in magicicada/settings/__init__.py:

    173 LOGGING = {
    ...
    204 'loggers': {
    205 'django': {
    206 'handlers': ['file'],
    207 'level': os.getenv('MAGICICADA_LOG_LEVEL', 'INFO'),
    208 'propagate': True,
    209 },
    ...
    221 }

And then just export the env var to the value you desire, or execute the server with:

MAGICICADA_LOG_LEVEL=DEBUG make start

Or alternatively, we could define a "debug" policy, a little big more "global", such as this:

LOG_LEVEL = 'INFO' if bool(os.getenv('MAGICICADA_DEBUG', None)) else 'DEBUG'
    173 LOGGING = {
    ...
    204 'loggers': {
    205 'django': {
    206 'handlers': ['file'],
    207 'level': LOG_LEVEL,
    208 'propagate': True,
    209 },
    ...
    221 }

What do you think?

« Back to merge proposal