Usually, for such error you need to update settings.py
with django-cors-headers
:
# update backend/server/server/settings.py
# ...
INSTALLED_APPS = [
#...
'corsheaders', # add it here
#...
]
# define which origins are allowed
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"http://127.0.0.1:3000"
]
# add to middleware
MIDDLEWARE = [
#...
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
#...
]
Sometimes you also need to set ALLOWED_HOSTS=["127.0.0.1"]
or with your other address (you can also try with "*", but just for debug).
You can check details in my article: React Token Based Authentication to Django REST API Backend.
Please also try to run tests with a cleared cache in the web browser.
If that doesn't help please provide more details about your project setup.