bench
bench copied to clipboard
Provide flag to `add-to-hosts` while creating a new site
Issue: Feature Request
Adding the newly created site is the first thing most of us do while developing on our local machines. Currently, we run a separate command after the site has been created (and sometimes we forget, only to know the page does not open in browser).
We can add a flag like so:
bench new-site cool.mysite.local --add-to-hosts
Create test sites with following pattern and you don't need to add to them to hosts.
testsite.localhost
Create test sites with following pattern and you don't need to add to them to hosts.
testsite.localhost
So, the .localhost extension is automatically routed to local host? Cool!
So, the .localhost extension is automatically routed to local host? Cool!
Not really. localhost
is added to /etc/hosts by default. Your machine's hostname is there too mostly. So site.host
also work.
λ cat /etc/hosts
127.0.0.1 localhost # <--- IPv4
::1 localhost # <--- IPv6
This command is in frappe btw
https://github.com/frappe/frappe/blob/fec24632a9aefdef014be7666af805646f1ce6e8/frappe/commands/site.py#L633-L640