跳到主要内容

Bench

Create new bench

bench init my_bench_name

Production Setup

bench setup production

Setup Python/Node Dependencies

bench setup requirements
bench setup socketio

Start/Restart

bench start bench restart

Healthcheck

bench doctor

Build JS Assets

bench build [--app my_app_name]

Backup all sites

bench backup-all-sites

Version Control

bench switch-to-develop # Frappe,ERPNext only
bench switch-to-branch branch_name [app1 app2..]

Site

Create new site

bench new-site abc.local
bench --site abc.local add-to-hosts
bench --site abc.local enable-scheduler

Backup

bench --site abc.local backup

Migrate

bench --site abc.local migrate [--no-backup]

Restore

bench --site abc.local restore <db-file-path>
[--with-public-files <public-archive-path>]
[--with-private files <private file-archive>]
bench --site abc.local partial-restore
[-v] <db-file-path>

Reinstall

bench --site abc.local reinstall

Drop Site

bench drop-site abc.local [--no-backup --force]

App

Create new app

bench new-app my_app_name

Add existing app

bench get-app <git-repo-url>
bench get-app erpnext # For 1st Party apps

Install app

bench --site abc.local install-app app1 app

Uninstall app

bench --site abc.local uninstall-app erpnext

Misc

Config

bench --site all show-config [-f text|json]
bench --site abc.local list-apps [-f text|json]
bench set-config -g allow_tests true
bench version [--format plain|json|table]

Database Maintenance

bench --site abc.local trim-database [--dry-run]
bench --site abc.local trim-tables [--dry-run]

Update Bench CLI

bench update --bench

Bench CLI Cheatsheet

frappeframework.com frappe.school frappe.cloud