Frappe is a multitenant platform and each tenant is called a site. A site has its own database. Sites exist in a directory called
sites, assumed as the current working directory when running a bench command.
The sites directory
frappe-bench/sites is where all the sites for this bench live. It also contains some other files and directories which are explained next.
This file contains a list of Frappe apps. An app should be listed here before it can be installed on a site. It is added automatically when
bench get-app command or
bench new-app command is run.
Configuration common to all sites can be put in this file. Learn more about site configuration.
Assets contain files that are required to be served for the client browser. These generally include *.js, *.css, and image files. This directory is auto generated using the
bench build command. This directory is served by Nginx in production.
Creating a new site
To create a new site, run the following command from the
$ bench new-site mysite.localhost
Updating DocTypes for frappe : [========================================]
Updating country info : [========================================]
*** Scheduler is disabled ***
mysite.local directory will now be created in the
│ ├── backups
│ └── files
│ └── files
This directory is used by the scheduler to synchronize various jobs using the file locking concept.
This directory contains files that require authentication to access. It contains private files and backups. They can be accessed by the URL:
This directory contains publicly accessible files. They can be accessed by the URL:
This file contains site specific configuration.
A file named
site_config.json exists in every site directory and is used to store site specific configuration. The values are available in
frappe.conf local variable as a dict.
To learn more about managing Site or Bench level configurations, checkout this comprehensive document.
While responding to an HTTP request, a site is automatically selected based on,
Hostheader in the HTTP request matches a site
X-Frappe-Site-Nameheader in the HTTP request matches a site
It is also possible to force the development server to serve a specific site by starting it with the following command:
bench --site mysite.localhost serve
Set a site as the current site
To force a site to be used as the default site, run the following command:
bench use mysite.localhost
After running this command, site specific commands can be run without the
For example, instead of running:
bench --site mysite.localhost migrate
You can just run: