From b7720ca1386c203b04c78954ef43fdd885198719 Mon Sep 17 00:00:00 2001 From: nprasad2077 <114438461+nprasad2077@users.noreply.github.com> Date: Fri, 21 Apr 2023 20:24:36 -0500 Subject: [PATCH] server is running proper! --- nba_stats/settings.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nba_stats/settings.py b/nba_stats/settings.py index eaeef38..82a83cf 100644 --- a/nba_stats/settings.py +++ b/nba_stats/settings.py @@ -34,7 +34,7 @@ SECRET_KEY = SECRET_DJANGO # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] # Application definition @@ -43,6 +43,7 @@ INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'nba_data', + 'corsheaders', 'rest_framework', 'django.contrib.contenttypes', 'django.contrib.sessions', @@ -51,6 +52,7 @@ INSTALLED_APPS = [ ] MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', @@ -142,3 +144,8 @@ REST_FRAMEWORK = { 'PAGE_SIZE': 100, # Adjust this value according to the number of records you want to display per page } +CORS_ALLOWED_ORIGINS = [ + "http://localhost:5173", # Replace this with the origin of your frontend app +] + +