fix: dynamically report backend_host in terminal logs #6165#6177
Open
pranavmanglik wants to merge 2 commits intoreflex-dev:mainfrom
Open
fix: dynamically report backend_host in terminal logs #6165#6177pranavmanglik wants to merge 2 commits intoreflex-dev:mainfrom
pranavmanglik wants to merge 2 commits intoreflex-dev:mainfrom
Conversation
Contributor
Greptile SummaryFixes the
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["rxconfig.py / CLI / Env Var"] -->|"sets backend_host"| B["Config.backend_host"]
B -->|"used by"| C["run_backend() / run_backend_prod()"]
C -->|"binds server to"| D["uvicorn / granian / gunicorn"]
B -->|"displayed by (this PR fix)"| E["notify_backend()"]
E -->|"prints"| F["Terminal: Backend running at http://host:port"]
Last reviewed commit: 8d83e61 |
masenf
reviewed
Mar 16, 2026
| """Output a string notifying where the backend is running.""" | ||
| console.print( | ||
| f"Backend running at: [bold green]http://0.0.0.0:{get_config().backend_port}[/bold green]" | ||
| f"Backend running at: [bold green]http://{get_config().backend_host}:{get_config().backend_port}[/bold green]" |
Collaborator
There was a problem hiding this comment.
instead of calling get_config() twice, cache the returned config and reference it in both places.
Author
There was a problem hiding this comment.
Thanks for your response, i actually new to open source. I thought about it but then had doubt if it was that necessary as it was being called twice only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Type of change
New Feature Submission:
Changes To Core Features:
Pull Request Details
Descriptive Title
fix: accurately report configured backend_host in terminal logsDescription of Changes
Currently, the
notify_backendfunction inreflex/utils/exec.pyhas the backend IP hardcoded as0.0.0.0. This leads to misleading terminal output when a user has explicitly configured a custombackend_host(e.g.,127.0.0.1for local-only development) in theirrxconfig.py.This PR modifies the notification logic to dynamically pull the
backend_hostfrom the Reflex configuration, ensuring the logs match the actual network binding. This improves developer clarity and assists in verifying security configurations.Testing performed:
backend_host="127.0.0.1"inrxconfig.py.http://127.0.0.1:8000instead of the hardcoded0.0.0.0.ruff) passes.Closing Issues
Closes #6165