wheels console
Start an interactive REPL console with Wheels application context loaded.
Synopsis
Description
The wheels console
command starts an interactive Read-Eval-Print Loop (REPL) with your Wheels application context fully loaded. This allows you to interact with your models, run queries, test helper functions, and debug your application in real-time.
The console requires your Wheels server to be running as it connects via HTTP to maintain the proper application context.
Options
environment
environment
Type: String
Default:
development
Description: Environment to load (development, testing, production)
Example:
wheels console environment=testing
execute
execute
Type: String
Description: Execute a single command and exit
Example:
wheels console execute="model('User').count()"
script
script
Type: Boolean
Default:
true
Description: Use CFScript mode (false for tag mode)
Example:
wheels console script=false
directory
directory
Type: String
Default: Current working directory
Description: Application directory
Example:
wheels console directory=/path/to/app
Examples
Basic Usage
Console Commands
Once in the console, you can use these special commands:
help
or?
- Show help informationexamples
- Show usage examplesscript
- Switch to CFScript modetag
- Switch to tag modeclear
orcls
- Clear screenhistory
- Show command historyexit
,quit
, orq
- Exit console
Working with Models
Using Helper Functions
Direct Database Queries
Inspecting Application State
How It Works
The console connects to your running Wheels server via HTTP
Code is sent to a special console endpoint for execution
The code runs in the full application context with access to all models and helpers
Results are returned and displayed in the console
Variables persist between commands during the session
Requirements
Wheels server must be running (
wheels server start
)Server must be accessible at the configured URL
Application must be in development, testing, or maintenance mode
Troubleshooting
"Server must be running to use console"
Start your server first:
"Failed to initialize Wheels context"
Check that your server is running:
wheels server status
Verify the server URL is correct
Ensure your application is not in production mode
Code execution errors
Check syntax - console shows line numbers for errors
Remember you're in CFScript mode by default
Use
tag
command to switch to tag mode if needed
Best Practices
Use for debugging: Test model methods and queries before implementing
Data exploration: Quickly inspect and modify data during development
Testing helpers: Verify helper function outputs
Learning tool: Explore Wheels functionality interactively
Avoid in production: Console should not be accessible in production mode
Security Notes
Console is only available in development, testing, and maintenance modes
Never expose console access in production environments
Be cautious when manipulating production data
Related Commands
wheels runner
- Execute script fileswheels environment
- Manage environment settingswheels server start
- Start the server
See Also
Last updated
Was this helpful?