This post explains how we can set homepage in a erpnext/frappe installation.
Default frappe installation doesn’t provide a homepage. You can create and set a homepage in several ways as described below:
This post assumes that you have a Frappe project initialized and you are able to add a site to your frappe installation.
Let’s add a site
$ bench new-site foo.bar
Let’s create an app and install it in the site foo.bar.
$ bench new-app meeting $ bench --site foo.bar install-app meeting
If you are logged in as an administrator and access the homepage i.e
foo.bar:8002, you would be redirected to the desk environment.
If you aren’t logged in as administrator, i.e for a Guest visitor, accessing homepage redirects to login page.
We want to change this behaviour and instead of redirecting to login page we want to show some content.
There are several alternatives provided by frappe to add a homepage. They are:
home_pageattribute of hooks.py
get_website_user_home_pageattribute of hooks.py
role_home_pageattribute of hooks.py
Using Website Settings
Homepage can be set using
Home Page field of
You can set it to any valid route of your project. There are some routes provided by default in any Frappe installation. eg:
/about and you should be able to see a page.
You can set
about as homepage of your application in the following way:
Clear cache and reload the homepage, and your about page content should show on homepage.
You can create a Web Page from the desk and set it as the homepage instead. You can learn about creating Web Pages from our other post.
Assuming you have created a Webpage with route
what-we-do which looks like:
You can set
what-we-do as homepage of your application in the following way:
Clear cache and reload the homepage, and your
what-we-do page should show on homepage.
You can set a custom webview added in www/ as your homepage too.
Assume we have a web view at
meeting/www/custom-homepage.html with associated controller at
meeting/www/custom_homepage.py. Read our last post to understand web view in detail.
Content of meeting/www/custom-homepage.html could be:
Content of meeting/www/custom_homepage.py could be:
def get_context(context): context['body'] = 'This is a custom homepage'
Home Page of
Website Settings to
Clear cache and reload the homepage. It should show content of web view
Using home_page attribute
You can set homepage using
home_page variable of hooks. This takes precedence over Website Settings homepage.
meeting/hooks.py and add module level attribute
home_page = "about"
Clear cache and load the homepage. It should show content of about page on homepage now.
Home Page, you can point
home_page hook to a www/ webview too.
home_page attribute of
meeting/hooks.py to point to this web view route.
home_page = "custom-homepage"
Clear cache and load the homepage. It should show content of web view
You can subscribe ⚛ to our blog.
We love building amazing apps for web and mobile for our clients. If you are looking for development help, contact us today ✉.
Would you like to download 10+ free Django and Python books? Get them here