bench drop-site
The bench drop-site command permanently removes an existing Frappe site from the current Bench. Before deleting the site, Bench creates a complete backup unless backup creation is explicitly disabled.
Warning:
This command deletes the site’s database. Although the site directory is archived by default, restoring the site later requires a valid backup and the archived site files.
Command Syntax
bench drop-site [OPTIONS] SITE
What the Command Does
When executed, the command performs the following actions:
- Creates a full backup of the site (unless disabled).
- Drops the site’s database.
- Moves the site’s directory from
./sitesto./archived_sitesby default.
Instead of permanently deleting the site files, Bench archives them so they can be referenced later if required.
Command Options
| Option | Description |
|---|---|
--db-root-username |
Specify the database administrator username with permission to drop databases. The default value is root. |
--db-root-password |
Specify the password for the database administrator. |
--archived-sites-path |
Specify a custom directory where the site’s files should be archived. |
Available Flags
--no-backup— Skip creating a backup before deleting the site.--force— Continue deleting the site even if errors occur during the process.
Examples
1. Delete a Site Using the Database Root Password
bench drop-site mysite.local --db-root-password rootpassword
Providing the database administrator password skips the interactive password prompt.
2. Delete a Site Without Creating a Backup
bench drop-site mysite.local --no-backup
This option removes the site immediately without generating a backup.
Use this option only when you are certain that the site’s data is no longer required.
3. Archive Site Files in a Custom Location
bench drop-site mysite.local --archived-sites-path /home/frappe/site-archives
Instead of using the default ./archived_sites directory, the site’s files are moved to the specified archive location.
Best Practice:
Always keep the default backup enabled before running bench drop-site. The backup and archived site directory provide the safest recovery option if the site needs to be restored later.