Django CORS issue with flutter web

I want to connect flutter web with Django server. flutter with mobile works well, but I can't solve the problem about flutter web.

when I run server with my ipv4

Django

python manage.py runserver 192:168:0:9:8000

Flutter

Uri.parse("http://192.168.0.9:8000/api/buildingdata/"),
      headers: {"Access-Control-Allow-Origin": "*"});

flutter run -d chrome --web-port=8000

Mobile version works well, but web version makes CORS error.

Access to XMLHttpRequest at 'http://192.168.0.9:8000/api/buildingdata/' from origin 
'http://localhost:8000' has been blocked by CORS policy: Request header field access-control-
allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.

browser_client.dart:74 GET http://192.168.0.9:8000/api/buildingdata/ net::ERR_FAILED

I tried to find solutions but none of them worked,

such as web-hostname command(this command can't even run flutter),

deleting flutter_tools.stamp and adding disable-web-security

Also I've tried to disable chrome CORS.

This is my django settings about cors

settings.py

MIDDLEWARE = [
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]


ALLOWED_HOSTS = ['*']


CORS_ALLOW_ALL_ORIGINS = True


CORS_ALLOW_CREDENTIALS = True

CORS_ALLOW_METHODS = (
    'DELETE',
    'GET',
    'OPTIONS',
    'PATCH',
    'POST',
    'PUT',
)

Where should I fix to solve CORS error?

Back to Top