use `with open()` so the file actually gets closed

This commit is contained in:
Scott King 2023-11-17 10:58:27 -07:00 committed by GitHub
parent 5e23993e5b
commit 03d94d7f44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -120,8 +120,8 @@ class cyberPanel:
websites = Websites.objects.all()
ipFile = "/etc/cyberpanel/machineIP"
f = open(ipFile)
ipData = f.read()
with open(ipFile, 'r') as f:
ipData = f.read()
ipAddress = ipData.split('\n', 1)[0]
json_data = []