Skip to content

lazy loading preserves click context#4461

Merged
davidism merged 1 commit into
mainfrom
cli-lazy-context
Feb 23, 2022
Merged

lazy loading preserves click context#4461
davidism merged 1 commit into
mainfrom
cli-lazy-context

Conversation

@davidism
Copy link
Copy Markdown
Member

When using lazy loading, which is the default when using the reloader, the app factory is called in a separate thread. Since the Click context is thread local, click.get_current_context() returns None. While the context shouldn't be relied on since it will never be available in production, this at least keeps it available consistently within the flask command.

closes #4460

@davidism davidism added the cli label Feb 23, 2022
@davidism davidism added this to the 2.1.0 milestone Feb 23, 2022
@davidism davidism merged commit 4843590 into main Feb 23, 2022
@davidism davidism deleted the cli-lazy-context branch February 23, 2022 03:13
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

click.get_current_context() returns None after reload

1 participant