Part 1 — Project Setup
In this first part, you'll create a new Lex App project, configure your environment, and verify everything works. By the end, you'll have a running (empty) Lex App application — ready for your models.
Create a Project Folder
mkdir -p ~/Projects/TeamBudget && cd ~/Projects/TeamBudgetWindows alternative
mkdir C:\Projects\TeamBudget cd C:\Projects\TeamBudget
Create a Virtual Environment
python3 -m venv .venv
source .venv/bin/activateYou should see (.venv) at the start of your prompt.
Windows alternative
venv .venv .venv\Scripts\activateOn some installations you may need to use
pyinstead ofpython.
Create requirements.txt
Create a file called requirements.txt in your project root:
lex-app
pandas
openpyxlThen install:
pip install -r requirements.txtWindows alternative
pip install -r requirements.txtIf you encounter any problem in windows try using
python -m pipon Windows to ensure you're using the virtual-environment pip.
Run the Setup Wizard
lex setupWindows alternative
lex setup
After the wizard completes, you'll have:
TeamBudget/
├── .env
├── .run/
│ ├── Init.run.xml
│ ├── Start.run.xml
│ └── Streamlit.run.xml
└── migrations/The .run/ folder contains PyCharm run configurations — these are pre-configured and will be the primary way to interact with your project.
Notice there's no
manage.pyor nested app folder. Lex App uses a flat layout — no Django boilerplate. Your models are organized into folders following the ETL convention.
Open in PyCharm
We recommend using PyCharm as your primary IDE — the setup wizard generates ready-made run configurations that handle environment variables automatically.
- Open PyCharm → File → Open → select your TeamBudget folder
- When prompted, set the Python interpreter to the
pythoninside your.venv
You'll see the run configurations appear in the top-right dropdown:
Run Configuration | What It Does |
|---|---|
Init | Creates/updates the database and syncs Keycloak |
Start | Runs the development server |
Streamlit | Starts the Streamlit dashboard server |
Set Up the ETL Folders
In PyCharm, right-click your project root → New → Directory and create three folders: Input, Upload, and Reports. Then create an empty __init__.py in each (right-click the folder → New → Python File → name it __init__).
Terminal alternative
Linux / macOS:mkdir Input Upload Reports touch Input/__init__.py Upload/__init__.py Reports/__init__.pyWindows PowerShell:
mkdir Input, Upload, Reports New-Item Input\__init__.py, Upload\__init__.py, Reports\__init__.py
Your project now reflects the ETL pattern:
TeamBudget/
├── .env
├── .run/
├── migrations/
├── Input/ ← Transform: core business entities will go here
│ └── __init__.py
├── Upload/ ← Extract: data ingestion will go here
│ └── __init__.py
└── Reports/ ← Load: calculations will go here
└── __init__.pyCreate the Database
In PyCharm's integrated terminal (View → Tool Windows → Terminal), run:
lex create_dbWindows alternative
lex create_db
Initialize
Select "Init" from the run configuration dropdown in PyCharm → click ▶️.
This runs Django migrations and sets up Keycloak. You should see:
Running migrations...
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
...
Syncing models to Keycloak... OKTerminal alternative
Linux / macOS:set -a; source .env; set +a lex InitWindows PowerShell:
Get-Content .env | ForEach-Object { if ($_ -match '^([^=]+)=(.*)$') { [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2]) } } lex InitPyCharm's run configurations auto-load
.envfor you — this is why we recommend using PyCharm.
Verify It Works
Select "Start" from the run configuration dropdown → click ▶️.
Open http://localhost:8000 in your browser. You should see the Lex App interface — empty for now, but working. The frontend uses AG Grid for data tables, which you'll see populated once you add models.
Terminal alternative
Linux / macOS:set -a; source .env; set +a lex startWindows PowerShell:
lex startPress
Ctrl+Cto stop.
Checkpoint
At this point you have:
- A working Lex App project with
Input/,Upload/, andReports/folders - PyCharm run configurations ready (Init, Start, Streamlit)
- Database created and migrations applied
- Server starts without errors
Next up: Part 2 — Data Models where you'll define the Team, Employee, and Expense models in Input/, plus upload models for CSV ingestion in Upload/.
Was this helpful?
Your feedback shapes what we write next.
