13 lines
399 B
Python
13 lines
399 B
Python
from django.conf import settings
|
|
|
|
|
|
def get_setting(prefix: str, key: str, default=None):
|
|
"""
|
|
Reads a setting with a given app prefix dict.
|
|
|
|
Example:
|
|
get_setting("INFRASYNTH_SECURITY", "COOKIE_SECURE", True)
|
|
Looks up settings.INFRASYNTH_SECURITY["COOKIE_SECURE"] with fallback to default.
|
|
"""
|
|
config = getattr(settings, prefix, {})
|
|
return config.get(key, default)
|