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 2 commits into
base: 1.21.x
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 Enhancement proposal 1.21.x Release target in 1.21.x labels Jul 17, 2022
@JoelLefkowitz JoelLefkowitz added 1.22.x Release target in 1.22.x and removed 1.21.x Release target in 1.21.x labels Jul 17, 2022
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 enhancement Enhancement proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants