How to Enable Developer Mode in Frappe and ERPNext
Enable Developer ModeLearn to enable developer mode for your Frappe or ERPNext site using the 'bench set-config' command. Essential for debugging and custom app development.
Enabling developer mode is a fundamental step for anyone building or customizing applications on the Frappe Framework. It disables server-side caching, provides detailed error tracebacks in the browser, and enables other development-friendly features. This allows for a much faster and more efficient development and debugging workflow. The primary tool for managing this setting is the Bench Command Line Interface (CLI).
# Enable developer mode for the default site
bench set-config developer_mode 1
# Enable developer mode for a specific site (e.g., erpnext.vm)
bench --site erpnext.vm set-config developer_mode 1
# After enabling, restart the bench to apply changes
bench restartUnderstanding This Code
What It Does
This command modifies the site's configuration file (`site_config.json`) to set the `developer_mode` flag to `1`, activating development-specific features in the Frappe framework.
When To Use
Use this command when you need to develop custom applications, debug server-side Python code, or see detailed error tracebacks directly in the UI. It's a critical first step after setting up a new development site.
Prerequisites
- •A working Frappe bench installation.
- •Terminal or SSH access to the server where the bench is located.
- •You must be in the main bench directory to run the commands.
Key Concepts
Important ideas to understand in this code
Bench CLI
Bench is the command-line tool used to manage Frappe/ERPNext applications. It helps with installation, site management, app management, and running various utilities.
Learn moresite_config.json
This is a crucial file located in `sites/{your-site-name}/` that holds site-specific configurations, including database credentials, caching settings, and flags like developer_mode.
Learn moreDeveloper Mode
A Frappe framework state that disables caches, enables live reloading for certain file types, and shows detailed error reports in the UI, making it indispensable for development.
Learn moreStep-by-Step Tutorial
Follow along to understand how this code works
Access Your Server
Open your terminal or use SSH to connect to the server where your Frappe bench is installed.
ssh user@your-server-ipNavigate to Your Bench Directory
Change your current directory to the root of your bench installation. This is typically named `frappe-bench`.
cd frappe-benchRun the Command
Execute the `set-config` command. If you have multiple sites, use the `--site` flag to specify which one you are targeting. If you omit the flag, it will apply to the default site.
# For a specific site named 'site1.local'
bench --site site1.local set-config developer_mode 1
# For the default site
bench set-config developer_mode 1Restart Bench Services
For the configuration change to take full effect, you must restart the bench services. This reloads the configuration for all processes.
bench restartCommon Issues & Solutions
Troubleshoot problems you might encounter