[Answer]-Building reusable package in django

1👍

I believe that once the “from django.conf import settings” line has executed, settings are effectively immutable.

What I would do is invert the logic a bit. In PACKAGE/__init__.py. Something like:

def get_apps():
    apps = (
        'apps.store',
        'apps.other',
        ...
    )
    return [__name__ + '.' + x for x in apps]

Then just:

INSTALLED_APPS += get_apps()

in settings.py. I do this quite a bit to keep our settings.py manageable and it seems to work quite well.

👤DavidM

Leave a comment