Skip to content

Commit

Permalink
Revert "refactor: force ipv4 localhost (#22394) (#22396)" (#22946)
Browse files Browse the repository at this point in the history
This reverts commit 69811a7.
  • Loading branch information
ankush committed Oct 27, 2023
1 parent b4ebde7 commit cb10eb0
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frappe/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def serve(
application = StaticDataMiddleware(application, {"/files": str(os.path.abspath(sites_path))})

application.debug = True
application.config = {"SERVER_NAME": "127.0.0.1:8000"}
application.config = {"SERVER_NAME": "localhost:8000"}

log = logging.getLogger("werkzeug")
log.propagate = False
Expand Down
2 changes: 1 addition & 1 deletion frappe/commands/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def start_ngrok(context, bind_tls):
port = frappe.conf.http_port or frappe.conf.webserver_port
tunnel = ngrok.connect(addr=str(port), host_header=site, bind_tls=bind_tls)
print(f"Public URL: {tunnel.public_url}")
print("Inspect logs at http://127.0.0.1:4040")
print("Inspect logs at http://localhost:4040")

ngrok_process = ngrok.get_ngrok_process()
try:
Expand Down
2 changes: 1 addition & 1 deletion frappe/email/test_smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def create_email_account(email_id, password, enable_outgoing, default_outgoing=0
"enable_incoming": 1,
"append_to": append_to,
"is_dummy_password": 1,
"smtp_server": "127.0.0.1",
"smtp_server": "localhost",
"use_imap": 0,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class NetworkPrinterSettings(Document):
@frappe.whitelist()
def get_printers_list(self, ip="127.0.0.1", port=631):
def get_printers_list(self, ip="localhost", port=631):
printer_list = []
try:
import cups
Expand Down
2 changes: 1 addition & 1 deletion frappe/tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def _get_transaction_id():
# Treat same DB as replica for tests, a separate connection will be opened
class TestReplicaConnections(FrappeTestCase):
def test_switching_to_replica(self):
with patch.dict(frappe.local.conf, {"read_from_replica": 1, "replica_host": "127.0.0.1"}):
with patch.dict(frappe.local.conf, {"read_from_replica": 1, "replica_host": "localhost"}):

def db_id():
return id(frappe.local.db)
Expand Down
2 changes: 1 addition & 1 deletion frappe/utils/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BackupGenerator:
"""
This class contains methods to perform On Demand Backup
To initialize, specify (db_name, user, password, db_file_name=None, db_host="127.0.0.1")
To initialize, specify (db_name, user, password, db_file_name=None, db_host="localhost")
If specifying db_file_name, also append ".sql.gz"
"""

Expand Down
2 changes: 1 addition & 1 deletion frappe/utils/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def is_open(ip, port, timeout=10):
def check_database():
config = get_conf()
db_type = config.get("db_type", "mariadb")
db_host = config.get("db_host", "127.0.0.1")
db_host = config.get("db_host", "localhost")
db_port = config.get("db_port", 3306 if db_type == "mariadb" else 5432)
return {db_type: is_open(db_host, db_port)}

Expand Down
2 changes: 1 addition & 1 deletion frappe/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ def get_url(uri: str | None = None, full_address: bool = False) -> str:
host_name = frappe.db.get_single_value("Website Settings", "subdomain")

if not host_name:
host_name = "http://127.0.0.1"
host_name = "http://localhost"

if host_name and not (host_name.startswith("http://") or host_name.startswith("https://")):
host_name = "http://" + host_name
Expand Down

0 comments on commit cb10eb0

Please sign in to comment.