Docs

Blog

Gallery

Resources

Learn

Components

API Reference

Onboarding

Getting-started

/

Configuration

Reflex apps can be configured using a configuration file, environment variables, and command line arguments.

Running reflex init will create an rxconfig.py file in your root directory. You can pass keyword arguments to the Config class to configure your app.

For example:

# rxconfig.py
import reflex as rx

config = rx.Config(
    app_name="my_app_name",
    # Connect to your own database.
    db_url="postgresql://user:password@localhost:5432/my_db",
    # Change the frontend port.
    frontend_port=3001,
)

See the config reference for all the parameters available.

You can override the configuration file by setting environment variables. For example, to override the frontend_port setting, you can set the FRONTEND_PORT environment variable.

FRONTEND_PORT=3001 reflex run

Finally, you can override the configuration file and environment variables by passing command line arguments to reflex run.

reflex run --frontend-port 3001

See the CLI reference for all the arguments available.

Reflex collects completely anonymous telemetry data about general usage. Participation in this anonymous program is optional, and you may opt-out if you'd not like to share any information.

Telemetry allows us to understand how Reflex is used, what features are most important, and how we can improve the product.

The following information is collected:

  • Operating system
  • CPU count
  • Memoryd
  • Python version
  • Reflex version

To disable telemetry, set telemetry_enabled=False in your rxconfig.py file.

config = rx.Config(
    app_name="hello",
    telemetry_enabled=False,
)

Alternatively, you can set the TELEMETRY_ENABLED environment variable to False.

The REFLEX_DIR environment variable can be set, which allows users to set the location where Reflex writes helper tools like Bun and NodeJS.

By default we use Platform specific directories:

On windows, C:/Users/<username>/AppData/Local/reflex is used.

On macOS, ~/Library/Application Support/reflex is used.

On linux, ~/.local/share/reflex is used.

← Project StructureIntro →

Did you find this useful?

HomeGalleryChangelogIntroductionHosting