i am creating a website that will monitors the real time hardware stats , for that i have made a client and that client sending data to defined socket, but for get data from that client i am running my django server at my pc’s ip at port 8000, and i have also added to allowed host but still getting the error of add the ip to allowed host
this is settings file
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-3b)la75(87-n54s5z4knwys=e6)i(7u%9(pgnr9ol@=86%8yer'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['192.168.1.24']
this is error
July 27, 2024 - 12:19:30
Django version 5.0.7, using settings 'gs8.settings'
Starting ASGI/Daphne version 4.1.2 development server at http://192.168.1.24:8000/
Quit the server with CTRL-BREAK.
Invalid HTTP_HOST header: '192.168.1.24:8000'. You may need to add '192.168.1.24' to ALLOWED_HOSTS.
Traceback (most recent call last):
File "D:\craw\env\Lib\site-packages\asgiref\sync.py", line 518, in thread_handler
raise exc_info[1]
File "D:\craw\env\Lib\site-packages\django\core\handlers\exception.py", line 42, in inner
response = await get_response(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\craw\env\Lib\site-packages\django\utils\deprecation.py", line 146, in __acall__
response = await sync_to_async(
^^^^^^^^^^^^^^^^^^^^
File "D:\craw\env\Lib\site-packages\asgiref\sync.py", line 468, in __call__
ret = await asyncio.shield(exec_coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Aakash Kumar\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\craw\env\Lib\site-packages\asgiref\sync.py", line 522, in thread_handler
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\craw\env\Lib\site-packages\django\middleware\common.py", line 48, in process_request
host = request.get_host()
^^^^^^^^^^^^^^^^^^
File "D:\craw\env\Lib\site-packages\django\http\request.py", line 151, in get_host
raise DisallowedHost(msg)
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '192.168.1.24:8000'. You may need to add '192.168.1.24' to ALLOWED_HOSTS.
Bad Request: /