Backend Setup
This guide walks you through setting up the Maybern Django backend for local development.All commands in this guide should be run from within the
backend/ directory unless otherwise specified.Set Up PostgreSQL Database
1
Add PostgreSQL to PATH
Add the PostgreSQL binaries to your shell path:
2
Set up libpq for psycopg
The libpq library is required for the Python PostgreSQL adapter:
3
Create database user
Create the When prompted for a password, enter
maybern user in PostgreSQL:maybern.4
Create database
Create the
maybern database with the new user as owner:Verify the database setup by running
psql -U maybern -d maybern -c '\dt'. You should connect successfully (the table list will be empty until migrations run).Set Up Python with Pyenv
1
Configure Pyenv
Add Pyenv to your shell configuration:
2
Install the project Python version
Install the Python version specified in the project’s
.python-version file:3
Set global Python version (optional)
Set this version as your global default:
Set Up uv for Dependency Management
1
Install uv
Install uv using the standalone installer:Or using Homebrew:
2
Verify installation
Check that uv is installed correctly:
Set Up Virtual Environment
1
Install dependencies
Create the virtual environment and install all dependencies:This will create a
.venv directory and install all dependencies from the lockfile.2
Activate the virtual environment
Activate the virtual environment:
Troubleshooting: uv Python version mismatch
Troubleshooting: uv Python version mismatch
If uv is using the wrong Python version:
-
Check what Python versions are available:
-
Verify Pyenv is using the correct version:
-
Pin uv to use the correct Python version:
-
Remove the existing virtual environment and reinstall:
Set Up Environment Variables
Create the local.env file from the template:
Reach out to your onboarding partner to get additional environment variables for third-party services (Stytch, AWS, etc.).
IDE Setup (VS Code / Cursor)
Install the recommended extensions for Python development:- Ruff: Python formatting and linting
settings.json: