Frappe CLIBash

How to Enable Developer Mode in Frappe and ERPNext

Enable Developer Mode

Learn 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).

Terminalbash
# 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 restart

Understanding 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 more

site_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 more

Developer 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 more

Step-by-Step Tutorial

Follow along to understand how this code works

1

Access Your Server

Open your terminal or use SSH to connect to the server where your Frappe bench is installed.

bash
ssh user@your-server-ip
Next Step
2

Navigate to Your Bench Directory

Change your current directory to the root of your bench installation. This is typically named `frappe-bench`.

bash
cd frappe-bench
Next Step
3

Run 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.

bash
# 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 1
Next Step
4

Restart Bench Services

For the configuration change to take full effect, you must restart the bench services. This reloads the configuration for all processes.

bash
bench restart

Common Issues & Solutions

Troubleshoot problems you might encounter