Course Content
Access site in your browser
COMPLETED
Faris Ansari
May 19, 2021

Now, that we have created our first site, we can access it on http://localhost:8000 in our browser.

Site Login Page

However, bench allows you to create multiple sites and access them separately in the browser on the same port. This is what we call multi-tenancy support in bench.

To achieve that, we must disable the serving of the default site. Go back to your terminal and delete the file sites/currentsite.txt from the frappe-bench directory.

$ rm sites/currentsite.txt

Now, you won't be able to access your site on http://localhost:8000.

Frappe will identify which site to serve by matching the hostname of the request with the site name, so you should be able to access your site on http://library.test:8000 but this won't work because we have to tell our operating system that library.test should point to localhost. To do that, you can add the following entry to your /etc/hosts file.

127.0.0.1 library.test

This will map library.test to localhost. Bench has a convenient command to do just that.

$ bench --site library.test add-to-hosts

This will ask for your root password and will add an entry to your /etc/hosts file.

Great, now you can access your site at http://library.test:8000. Congratulations for making it this far.

Questions
Show how to set a default site
JH Jason Hunt
2 months ago
Post
Dismiss

For localhost development, I prefer to set default site instead of adding an entry to /etc/hosts. For example:

bench use library.test

Want to discuss?
Post it here, our mentors will help you out.
bug
utkarsh agrawal
5 months ago
Post
Dismiss

the next button is broken.

it does not work if the lesson is completed

it works only if lesson is currently marked as not completed

MG Maneet Goyal
4 months ago
Post
Dismiss

Same issue. Button Broken.

JH Jason Hunt
2 months ago
Post
Dismiss

It works now

Want to discuss?
Post it here, our mentors will help you out.