from pcweb import constants
import reflex as rx
app_name = "my_app_name"
default_url = "http://localhost:3000"
Reflex requires Python 3.8+.
We highly recommend creating a virtual environment for your project.
venv is the standard option. conda and poetry are some alternatives.
We will go with venv here.
macOS (Apple Silicon) users should install Rosetta 2. Run this command:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Replace {app_name}
with your project name. Switch to the new directory.
mkdir {app_name}
cd {app_name}
python3 -m venv .venv
source .venv/bin/activate
# Error `No module named venv`
While Python typically ships with `venv` it is not installed by default on some systems.
If so, please install it manually. E.g. on Ubuntu Linux, run `sudo apt-get install python3-venv`.
Reflex is available as a pip package.
pip install reflex
# Error `command not found: pip`
While Python typically ships with `pip` as the standard package management tool, it is not installed by default on some systems.
You may need to install it manually. E.g. on Ubuntu Linux, run `apt-get install python3-pip`
reflex init
# Error `command not found: reflex`
If you install Reflex with no virtual environment and get this error it means your `PATH` cannot find the reflex package.
A virtual environment should solve this problem, or you can try running `python3 -m` before the reflex command.
For Windows users, we recommend using Windows Subsystem for Linux (WSL) for optimal performance.
WSL users should refer to instructions for Linux above.
For the rest of this section we will work with native Windows (non-WSL).
We will go with venv here, for virtual environments.
mkdir {app_name}
cd {app_name}
py -3 -m venv .venv
.venv\\Scripts\\activate
pip install reflex
reflex init
# Error `command not found: reflex`
The Reflex framework includes the `reflex` command line (CLI) tool. Using a virtual environment is highly recommended for a seamless experience (see below).",
Run it in development mode:
reflex run
Your app runs at http://localhost:3000.
Reflex prints logs to the terminal. To increase log verbosity to help with debugging, use the --loglevel
flag:
reflex run --loglevel debug
Reflex will hot reload any code changes in real time when running in development mode. Your code edits will show up on http://localhost:3000 automatically.
The demo app showcases some of Reflex's features.
reflex demo