Reflex Cloud - Fast, secure & scalable hosting. One command to deploy.

Config

reflex.config.Config

The config defines runtime settings for the app.

By default, the config is defined in an rxconfig.py file in the root of the app.

Every config value can be overridden by an environment variable with the same name in uppercase. For example, db_url can be overridden by setting the DB_URL environment variable.

See the configuration docs for more info.

Fields

PropDescription
app_name: str

The name of the app (should match the name of the app directory).

loglevel: LogLevel = LogLevel.DEFAULT

The log level to use.

frontend_port: int = 3000

The port to run the frontend on. NOTE: When running in dev mode, the next available port will be used if this is taken.

frontend_path: str

The path to run the frontend on. For example, "/app" will run the frontend on http://localhost:3000/app

backend_port: int = 8000

The port to run the backend on. NOTE: When running in dev mode, the next available port will be used if this is taken.

api_url: str = http://localhost:8000

The backend url the frontend will connect to. This must be updated if the backend is hosted elsewhere, or in production.

deploy_url: str = http://localhost:3000

The url the frontend will be hosted on.

backend_host: str = 0.0.0.0

The url the backend will be hosted on.

db_url: str = sqlite:///reflex.db

The database url used by rx.Model.

async_db_url: str

The async database url used by rx.Model.

redis_url: str

The redis url

telemetry_enabled: bool = True

Telemetry opt-in.

bun_path: Path = /Users/alekpetuskey/Library/Application Support/reflex/bun/bin/bun

The bun path

static_page_generation_timeout: int = 60

Timeout to do a production build of a frontend page.

cors_allowed_origins: str = ['*']

List of origins that are allowed to connect to the backend API.

tailwind: Any = {'plugins': ['@tailwindcss/typography']}

Tailwind config.

timeout: int = 120

Timeout when launching the gunicorn server. TODO(rename this to backend_timeout?)

next_compression: bool = True

Whether to enable or disable nextJS gzip compression.

react_strict_mode: bool = True

Whether to use React strict mode in nextJS

frontend_packages: str

Additional frontend packages to install.

cp_backend_url: str = https://cloud-29f4f535-4fb8-48b9-8b55-2000f2782aee.fly.dev/

The hosting service backend URL.

cp_web_url: str = https://cloud.reflexcorp.run/

The hosting service frontend URL.

gunicorn_worker_class: str = uvicorn.workers.UvicornH11Worker

The worker class used in production mode

gunicorn_workers: int

Number of gunicorn workers from user

gunicorn_max_requests: int = 100

Number of requests before a worker is restarted

gunicorn_max_requests_jitter: int = 25

Variance limit for max requests; gunicorn only

state_manager_mode: StateManagerMode = StateManagerMode.DISK

Indicate which type of state manager to use

redis_lock_expiration: int = 10000

Maximum expiration lock time for redis state manager

redis_lock_warning_threshold: int = 1000

Maximum lock time before warning for redis state manager.

redis_token_expiration: int = 3600

Token expiration time for redis state manager

env_file: str

Path to file containing key-values pairs to override in the environment; Dotenv format.

Methods

SignatureDescription
update_from_env(self) -> 'dict[str, Any]'Update the config values based on set environment variables. If there is a set env_file, it is loaded first.
get_event_namespace(self) -> 'str'Get the path that the backend Websocket server lists on.