Usage

bench new-site [OPTIONS] SITE

Description

Create a new Frappe site. This operation creates a new folder under ./sites which will contain all the site information for the site and also creates a new database in your DBMS with all of Frappe's Modules and DocTypes installed.

The site config, which can be found under ./sites/{site}/site_config.json maintains information about the site's state. For more information about it, check out this guide.

If site creation fails due to any reason, you'll be prompted as to whether you'd like to rollback the changes made, which are the creation of the site directory, and the creation of a database and database user.

Options

  • --db-name Set the Database name for new site - also used as the database username if not specified separate

  • --db-user From v16 onwards, choose the database user name OR specify an existing user+password combination

  • --db-password Set the Database password for new site, or password for existing specified database user.

  • --db-type Select the Database Type for new site, options being "postgres" or "mariadb". Default is "mariadb"

  • --db-host Set Database Host for new site

  • --db-port Set Database Port for new site

  • --db-root-username Specify Root username for MariaDB or Postgres

  • --db-root-password Specify Root password for MariaDB or Postgres

  • --admin-password Specify the Administrator password for new site

  • --source_sql Initiate database with a SQL file

  • --install-app Install app after installation

Flags

  • --no-mariadb-socket Set MariaDB host to % and use TCP/IP Socket instead of using the UNIX Socket

  • --verbose Add Verbosity

  • --force Force restore if the site or a database with the same name already exists

Examples

  1. Create a new site.

    bench new-site {site}
  2. Create a new PostgreSQL site.

    bench new-site {site} --db-type postgres
  3. Create a new site while skipping the interactive prompts for

    • Submitting the Site's Administrator Password

    • Submitting the MariaDB Root Password

      bench new-site {site}
         --admin-password {admin-password}
         --db-root-password {mariadb-password}
  4. Create a new site with non-default and autogenerated values.

    bench new-site {site} --db-type {type}
       --db-name {name}
       --db-user {user}
       --db-password {pass}
       --db-host {host}
       --db-port {port}
  5. Create a new site with a MariaDB non-root user with database creation privileges.

    bench new-site {site}
       --db-root-username {user}
       --db-root-password {pass}
  6. Create a new site with an app (available on current bench) installed.

    bench new-site {site} --install-app {app}