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

[IMPL] - Custom backend server and improved configuration capabilities #4624

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

KronosDev-Pro
Copy link

Original PR: #4337

Idea

Customize the backend server configuration as you like, and create a complete new backend server support.

can be easily split into another reflex package, for example pip install reflex[granian].

Example

We can define which BackendServer to use for development and production modes and thus customize the configuration (all parameters for each BackendServer are the actual parameters corresponding to the web server involved).

import reflex as rx
from reflex import server

config = rx.Config(
    app_name="examples",
    backend_server_dev = server.GunicornBackendServer(
        worker_class="uvicorn.workers.UvicornH11Worker",
        max_requests=100,
        max_requests_jitter=25,
        timeout=120,
        threads=1,
        workers=1,
    ),
    backend_server_prod = server.GranianBackendServer(
        threads=2,
        workers=4,
    )
)

We can also create a customized BackendServer with the CustomBackendServer class, such as GranianBackendServer


All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@KronosDev-Pro
Copy link
Author

KronosDev-Pro commented Jan 12, 2025

@adhami3310 this is the new PR, apparently it solved the problems

I will test again, with a different version of python and other sample projects. ✔️

@KronosDev-Pro KronosDev-Pro marked this pull request as ready for review January 12, 2025 20:53
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

Successfully merging this pull request may close these issues.

1 participant