Overview
Thebench init command creates a new bench instance in a specified directory. It sets up the complete environment including Python virtual environment, clones the Frappe framework, configures Redis, creates a Procfile for process management, and optionally installs specified apps.
Syntax
Arguments
The directory path where the bench instance will be created. This can be a relative or absolute path.
Options
Clone a particular branch of Frappe. Alias:
--versionPath to the Python executable to use for creating the virtual environment.
Ignore if a bench instance already exists at the specified path. Without this flag, init will fail if the directory exists.
Path to a JSON file containing a list of apps to install after initialization.
Path to an existing Frappe repository to use instead of cloning from remote.
Copy repositories from an existing bench directory instead of cloning from remote sources.
When using
--clone-from, copy repos without running git pull to update them.Do not create a Procfile for process management. Use this if you plan to manage processes differently.
Do not set up automatic periodic backups for all sites on this bench.
Skip Redis configuration generation. Useful when you’re providing a custom common_site_config.json with Redis settings.
Do not build front-end assets after initialization. Useful for faster setup when you’ll build assets later.
Install a particular app immediately after bench initialization.
Enable verbose output during the installation process.
Enable developer mode and install development dependencies. This is useful for Frappe app development.
Usage Examples
Basic Initialization
Create a new bench with default settings:Initialize with Specific Frappe Version
Create a bench with a specific Frappe branch:Development Setup
Initialize a bench for development with dev dependencies:Production-Ready Setup
Create a bench without assets build (for faster setup) and without automatic backups:Clone from Existing Bench
Copy apps from an existing bench directory:Custom Python Version
Specify a particular Python executable:Install App During Init
Initialize bench and immediately install an app:Common Patterns
Quick Development Setup
For developers who want to get started quickly:CI/CD Pipeline Setup
For automated builds and testing:Error Handling
If initialization fails, you’ll be prompted to rollback changes. The command will automatically clean up the partially created bench directory if you confirm the rollback.
What Gets Created
When you runbench init, the following structure is created:
- apps/ - Directory containing all Frappe apps
- sites/ - Directory for site instances
- env/ - Python virtual environment
- config/ - Configuration files (Procfile, Redis configs)
- logs/ - Log files directory
- archived/ - Archived files directory
Related Commands
bench new-site- Create a new site in the bench (Frappe framework command)bench get-app- Add apps to the benchbench start- Start the bench development serverbench setup production- Configure production environment