WSL (Windows Subsystem for Linux)
Overview
The dev_tool can be built and run inside WSL2 on Ubuntu. This guide walks through the setup process for building and running the dev_tool from a WSL environment, using the project files on the Windows filesystem.
Prerequisites
- Windows 11 with WSL2 enabled
- Ubuntu installed via WSL
- Docker Desktop for Windows with WSL integration enabled
- A dev-tool key (
Dev Tools Key) from the BitWarden vault pyproject.tomlin the root directory of your projectdevelopment.envin the root directory of your project
Docker Desktop Configuration
Docker Desktop must be configured to expose the Docker daemon to your WSL distro:
- Open Docker Desktop on Windows
- Navigate to Settings > Resources > WSL Integration
- Toggle on your Ubuntu distro
- Click Apply & restart
- Verify from WSL:
System Dependencies
Open your WSL terminal and install the required system packages:
sudo apt update
sudo apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libffi-dev liblzma-dev libpq-dev
uv
The build.sh script will install uv automatically on the first run. If you need to install it manually:
If uv is installed but not found in subsequent sessions, add the source line to your shell profile:
Personal Access Token (PAT)
The dev_tool requires a GitHub PAT to check for updates. Copy the token from your Windows setup:
Replace <Username> with your Windows username.
Building the dev_tool
The build.sh script is located inside the dev_tool directory of the repository. It can be run from any directory.
Since the script lives on the Windows filesystem, line endings must be fixed before the first run and after any edit from Windows:
sed -i 's/\r$//' /mnt/c/Users/<Username>/PycharmProjects/dev-tools/dev_tool/build.sh
chmod +x /mnt/c/Users/<Username>/PycharmProjects/dev-tools/dev_tool/build.sh
Build both the launcher and CLI:
You can also build them individually:
/mnt/c/Users/<Username>/PycharmProjects/dev-tools/dev_tool/build.sh dev_tool
/mnt/c/Users/<Username>/PycharmProjects/dev-tools/dev_tool/build.sh cli
The executables are placed in ~/stratus/.
Note:
The
build.shscript does not rungit pull. Pull the latest code from Windows before building.
Running the dev_tool
Navigate to your project directory and run the launcher:
Running the Django Server
When running the Django development server from WSL, use the Run on local IP option from the dev_tool menu. The server will bind to 0.0.0.0:8000, which allows Windows to access it.
Access the server from your Windows browser at:
Note:
WSL2 runs in a virtual machine with its own network adapter. Binding to
0.0.0.0is required for Windows to reach the server through localhost forwarding. The127.0.0.1address is local to the WSL VM and is not accessible from Windows.
Stale Lock Port
If the dev_tool exits unexpectedly (e.g., via a forced kill or WSL crash), the lock socket may persist and prevent relaunch. You will see a message like:
If no instance is actually running, restart WSL from PowerShell on Windows:
Then reopen WSL and run the dev_tool again.
Virtual Environments
Virtual environments created in WSL are not compatible with Windows and vice versa. If you rebuild a development environment in WSL, the .venv directory will be created with Linux binaries. This will cause issues when returning to Windows.
Before switching back to Windows, remove the .venv directory created by WSL and rebuild the development environment from Windows using the dev_tool.