from django.conf import settings hash = { "TICKETS_LIMIT_FILE_ATTACHMENTS": [".jpg", ".gif", ".png", ".csv", ".pdf", ".zip", ".txt"], "TICKETS_MAXIMUM_ATTACHMENT_SIZE": 5000000, "TICKETS_PUBLIC_SUBMIT_REDIRECT": "/", } def defaults(key: str): """Try to get a setting from project settings. If empty or doesn't exist, fall back to a value from defaults hash.""" if hasattr(settings, key): val = getattr(settings, key) else: val = hash.get(key) return val