This guide walks you through setting up a local development environment for Ralph without Docker. This approach gives you direct control over the Python environment and is ideal for debugging and active development.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/allegro/ralph/llms.txt
Use this file to discover all available pages before exploring further.
This guide assumes you’re running a POSIX-compliant environment (Linux, macOS, or WSL on Windows).
Prerequisites
Ensure the following tools are installed on your system:- Python 3.10 (Ralph requires Python >=3.10.0, <3.11)
- pip - Python package manager
- virtualenvwrapper - Virtual environment management
- Node.js (v8.10.0 - v11.7.0) - For building static assets
- npm (3.5.2 - 6.5.0) - JavaScript package manager
- mysql-client system library
- macOS:
brew install mysql - Ubuntu/Debian:
apt-get install libmysqlclient-dev
- macOS:
- Docker & docker-compose - For running service dependencies (database, cache)
Installation Steps
Create a virtual environment
Create and activate a Python virtual environment:The environment will be activated automatically after creation. To activate it later:
Install Python dependencies
Install the development dependencies:The development dependencies include useful tools like:
You may need to install additional system libraries and build tools if compilation fails for certain packages.
django-debug-toolbar- Debug panel for Djangoipdb,ipython,pudb- Interactive debuggersruff- Fast Python linterdjango-silk- Performance profiling
Install JavaScript dependencies
Install Node.js packages and build static assets:Then build the static files using Gulp:
Start required services
Use Docker Compose to run the database and cache services:This starts:
- MySQL 5.7 on port 3306 (or PostgreSQL on port 54320)
- Redis 4.0 on port 6379
- inkpy - Ralph’s background worker service
- Database:
ralph_ng - User:
ralph_ng/ password:ralph_ng - Volumes stored in
./volumes/directory
Configure Django settings
Copy the local settings template:Set the Django settings module environment variable:
Initialize the database
Run database migrations and create a superuser:Follow the prompts to create your admin user credentials.
Initialize the menu structure
Synchronize the site menu tree:This runs
ralph sitetree_resync_apps to set up navigation.Access Ralph
Open your browser and navigate to:Development Workflow
Auto-reload
The development server automatically detects changes to Python files and reloads. You don’t need to restart manually.Database Configuration
The default configuration insrc/ralph/settings/local.template supports both MySQL and PostgreSQL. Switch between them using the DB_ENGINE environment variable:
Useful Commands
| Command | Description |
|---|---|
make run | Start development server |
make menu | Resync site tree navigation |
make test | Run test suite |
make coverage | Run tests with coverage report |
make checks | Run ruff linter |
make clean | Remove compiled Python files |
./node_modules/.bin/gulp | Rebuild static assets |
Troubleshooting
Python Package Build Failures
If you encounter errors installing Python packages, ensure you have the required system libraries: Ubuntu/Debian:Static Files Not Loading
If CSS/JS assets aren’t loading:- Verify Node.js and npm versions are compatible
- Delete
node_modules/and reinstall:npm install - Rebuild static files:
./node_modules/.bin/gulp
Database Connection Issues
Verify services are running:Next Steps
Docker Environment
Learn about Docker-based development
Architecture
Understand Ralph’s architecture