Reflex Logo

Intro

Gallery

Hosting

Learn

Components

Recipes

API Reference

Onboarding

Api-reference

/

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.

# rxconfig.py
import reflex as rx

config = rx.Config(
    app_name="myapp",
    api_url="http://localhost:8000",
)

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.

PropDescription
app_name: str

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

loglevel: LogLevel = LogLevel.INFO

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.

redis_url: str

The redis url

telemetry_enabled: bool = True

Telemetry opt-in.

bun_path: str = /home/runner/.local/share/reflex/bun/bin/bun

The bun path

cors_allowed_origins: str = ['*']

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

tailwind: Any

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://rxcp-prod-control-plane.fly.dev

The hosting service backend URL.

cp_web_url: str = https://control-plane.reflex.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

redis_lock_expiration: int = 10000

Maximum expiration lock time for redis state manager

redis_token_expiration: int = 3600

Token expiration time for redis state manager

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

Did you find this useful?

HomeGalleryChangelogIntroductionHosting