Is this a good approach to have projects which require editing of hosts file?
In the projects I have worked on, there was a config file or environment variable which cleanly switched servers to localhost, no hosts editing necessary.
I've needed to do it to test with external SAML/OpenID Connect providers since pretending to be the hostname they expect is sometimes the only way to test, depending on the partner.