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

Avoid triggering django.setup() when importing settings. #743

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

koniiiik
Copy link

Importing the module drf_yasg.app_settings has a side effect of immediately triggering django.setup() once the call to getattr(settings, "LOGIN_URL", None) is encountered. This makes it impossible to import the default YASG settings at the beginning of your Django settings module in order to extend some of the default values with application-specific customizations.

This patch wraps the LOGIN_URL fallback into a lazy string object to delay the evaluation of Django settings.

@JoelLefkowitz JoelLefkowitz changed the base branch from master to 1.21.x July 17, 2022 17:07
@JoelLefkowitz JoelLefkowitz added enhancement 1.21.x Release target in 1.21.x 1.22.x Release target in 1.22.x and removed 1.21.x Release target in 1.21.x labels Jul 17, 2022
@JoelLefkowitz JoelLefkowitz deleted the branch axnsan12:master October 17, 2024 11:55
@JoelLefkowitz JoelLefkowitz reopened this Oct 17, 2024
@JoelLefkowitz JoelLefkowitz changed the base branch from 1.21.x to master October 17, 2024 12:03
@koniiiik koniiiik force-pushed the avoid-triggering-django-setup-on-settings-import branch from f2f97b2 to e8d1b7c Compare October 17, 2024 12:07
@koniiiik koniiiik force-pushed the avoid-triggering-django-setup-on-settings-import branch from e8d1b7c to 5b65255 Compare October 17, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.22.x Release target in 1.22.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants