UnicodeDecodeError with socket.getfqdn in Django runserver on Windows
I’m building a Django API. After transferring my project to a new server and attempting to run it with:
python manage.py runserver
I encountered the following exception:
File "", line 795, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 19: invalid start byte
I verified my hostname using the hostname command in the terminal. It returned: DESKTOP-KTU1TC2 (consists of only ASCII characters). I have also run this code, but everything works just fine.
>>>import socket
>>>socket.gethostbyname('127.0.0.1')
127.0.0.1
>>>socket.gethostbyname('DESKTOP-KTU1TC2')
(some ip address)
I have also tried to explicitly start the server with:
python manage.py runserver 127.0.0.1:8000
The error persists.
Environment Details: Python: 3.12 Django: 5.1.4
What should i try to resolve this issue? Thank you in advance