Bench Commands Cheatsheet
Printable Bench CLI Cheatsheet
Grab a A4 size printable cheatsheet of the most important Bench CLI commands here. Download, print and put it on your desk!
General Usage
bench --version
- Show bench versionbench version
- Show version of all appsbench src
- Show bench repo directorybench --help
- Show all commands and helpbench [command] --help
- Show help for commandbench init [bench-name]
- Create a new bench (Run from home dir)--python TEXT
Path to Python Executable.--ignore-exist
Ignore if Bench instance exists.--apps_path TEXT
path to json files with apps to install after init--frappe-path TEXT
path to frappe repo--frappe-branch TEXT
Clone a particular branch of frappe--clone-from TEXT
copy repos from path--clone-without-update
copy repos from path without update--no-procfile
Pull changes in all the apps in bench--no-backups
Run migrations for all sites in the bench--no-auto-update
Build JS and CSS artifacts for the bench--skip-redis-config-generation
Skip redis config generation if already specifying the common-site-config file--verbose
Verbose output during install
bench --site [site-name] COMMAND
- Specify site for commandbench update
- Pulls changes for bench-repo and all apps, applies patches, builds JS and CSS, and then migrates.--pull
Pull changes in all the apps in bench--patch
Run migrations for all sites in the bench--build
Build JS and CSS artifacts for the bench--bench
Update bench--requirements
Update requirements--restart-supervisor
restart supervisor processes after update--no-backup
Don't take a backup before update--reset
Ignore local changes and update--dev
Enable developer mode on the new bench and install developer dependencies which are required for running tests.
bench restart
Restart all bench servicesbench backup
Create a backup of the default site.
Backup will be saved to ~/frappe-bench/sites/{your site}/private/backups/
.
* bench backup-all-sites
Backup all sites
+ `--with-files` Backup site with files
* bench restore
Restore
+ `--with-private-files` Restore site with private files (Path to tar file)
+ `--with-public-files` Restore site with public files (Path to tar file)
* bench migrate
Run patches, sync schema and rebuild files/translations
+ `--rebuild-website TEXT` Rebuild webpages after migration
* bench migrate-env [python-version]
Will migrate the virtual environment to the desired python version
* bench --site [sitename] set-admin-password [password]
Will reset the administrator password
* bench destroy-all-sessions
Destroys all sessions
Config
bench config
- Change bench configurationauto_update [on/off]
Enable/Disable auto update for benchdns_multitenant [on/off]
Enable/Disable DNS Multitenancyhttp_timeout
Set http timeoutrestart_supervisor_on_update
Enable/Disable auto restart of supervisorserve_default_site
Configure nginx to serve the default site onupdate_bench_on_update
Enable/Disable bench updates on running bench...
bench setup
- Setup componentsauto-update
Add cronjob for bench auto updatebackups
Add cronjob for bench backupsconfig
overwrite or make config.jsonenv
Setup virtualenv for benchnginx
generate config for nginxprocfile
Setup Procfile for bench startproduction
setup bench for productionredis
generate config for redis cachesocketio
Setup node deps for socketio serversudoers
Add commands to sudoers list for execution...supervisor
generate config for supervisoradd-domain
add custom domain for sitefirewall
setup firewall and block all ports except 22, 80 and 443ssh-port
change the default ssh connection portrequirements
Update Python and Node packages--node
Update only Node packages--python
Update only Python packages--dev
Update only Python development dependencies.
bench set-nginx-port [sitename] [port]
- Set site's port in Production
Development
bench new-app [app-name]
Creates a new appbench get-app [repo-link]
- Downloads an app from a git repository and installs it--branch [branch-name]
Fetches specific branch of app
bench install-app [app-name]
Installs existing appbench remove-from-installed-apps [app-name]
Remove app from the list of appsbench uninstall-app [app-name]
Delete app and everything linked to the app (Bench needs to be running)bench remove-app [app-name]
Remove app from the bench entirelybench --site [sitename] --force reinstall
Reinstall with fresh database (Caution: Will wipe out old database)bench new-site [sitename]
- Creates a new site--db-name
Database name--db-host
Custom database host URL for remote connection--db-port
Custom database listening port (eg. port other than the default 3306)--mariadb-root-username
Root username for MariaDB--mariadb-root-password
Root password for MariaDB--admin-password
Administrator password for new site--verbose
Verbose--force
Force restore if site/database already exists--source_sql
Initiate database with a SQL file--install-app
Install app after installation`
bench use [site]
Sets a default sitebench drop-site
Removes site from disk and database completely--root-login
--root-password
bench set-config [key] [value]
Adds a key-value pair to site's config filebench console
Opens a IPython console in the bench venv--autoreload
Reload changes to code automatically
bench execute
Execute a method inside any app.- Eg :
bench execute frappe.utils.scheduler.enqueue_scheduler_events
- Eg :
bench --site [sitename] mariadb
Opens SQL Consolebench --site [sitename] export-fixtures [--app TEXT]
Export the records defined in the app's hooks as JSON files.bench run-tests
Run tests--app
App Name--doctype
DocType to run tests for--test
Specific Test--module
Run a particular module that has tests--profile
Runs a Python profiler on the test
bench disable-production
Disables production environmentbench serve
Start a development web server on0.0.0.0
--port
Start the web server on a different port (default: 8000)--profile
Add a profiler middleware that prints exactly which backend methods get called, how often and how long it takes.--proxy
The development server may be run behind a proxy, e.g. ngrok / localtunnel--noreload
Disable automatic restarting of the server when files change.--nothreading
Disable handling of concurrent requests using threads. Can lead to unexpected behavior when multiple threads are required (for example during PDF generation).--with-coverage
Measure code coverage and create a reportcoverage.xml
in thesites/
folder. Also activates--noreload
and--nothreading
.
Scheduler
bench enable-scheduler
- Enables Scheduler that will run scheduled tasksbench doctor
- Get diagnostic info about background workersbench show-pending-jobs
- Get pending jobsbench purge-jobs
- Destroy all pending jobs
Data Import
bench data-import
- Imports Bulk Data from .csv, .xls or .xlsx--file
File Name--doctype
The DocType--type
Insert/Update