Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to override Settings class #95

Open
hossainirad opened this issue Jan 26, 2025 · 1 comment
Open

How to override Settings class #95

hossainirad opened this issue Jan 26, 2025 · 1 comment

Comments

@hossainirad
Copy link

Hi there, I need override Settings class because some of my configurations have to be calculated. So setting environment variable is not best choice for me.
Thank you.

@hossainirad
Copy link
Author

I handled it with this in main.py:

for key in dir(app_settings):
    if key.isupper():  # Only copy settings that are uppercase (convention for constants)
        value = getattr(app_settings, key)
        setattr(settings, key, value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant