-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c47b5c
commit da1019a
Showing
1 changed file
with
201 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,212 @@ | ||
# CORS (Cross-Origin Resource Sharing) settings | ||
# Settings for enabling Cross-Origin Resource Sharing, allowing resources to be shared across different origins | ||
""" | ||
Django settings for pure_plate project. | ||
CORS_ORIGIN_ALLOW_ALL = True # Allow CORS for all origins | ||
Generated by 'django-admin startproject' using Django 4.2.13. | ||
CORS_ALLOW_CREDENTIALS = True # Allow credentials for CORS requests | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.2/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/4.2/ref/settings/ | ||
""" | ||
|
||
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/4.2/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = 'django-insecure-m!l2agfxj6og1mqq4wqdvekx5^f+)!*q!%!h#+4y$vof)@@68p' | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = ["*"] | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'rest_framework', | ||
'rest_framework.authtoken', | ||
'account', | ||
'restaurant', | ||
'review', | ||
'favorite', | ||
'feedback', | ||
'corsheaders' | ||
|
||
] | ||
|
||
MIDDLEWARE = [ | ||
'corsheaders.middleware.CorsMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'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', | ||
] | ||
|
||
CORS_ORIGIN_ALLOW_ALL = True | ||
|
||
CORS_ALLOW_CREDENTIALS = True | ||
|
||
# List of allowed origins (domains) | ||
# This is used instead of CORS_ALLOW_ORIGIN setting, and '*' allows all origins | ||
CORS_ALLOWED_ORIGINS = ( | ||
'http://localhost:3000', # Allow from localhost:3000 | ||
'http://127.0.0.1:3001', # Allow from localhost:3001 | ||
'https://www.pureplate.site:80', # Allow from pureplate.site (http) on port 80 | ||
'https://pureplate.site:80', # Allow from pureplate.site (http) on port 80 | ||
'http://www.pureplate.site:80', # Allow from pureplate.site (http) on port 80 | ||
'http://pureplate.site:80', # Allow from pureplate.site (http) on port 80 | ||
'https://www.pureplate.site:443', # Allow from pureplate.site (https) on port 443 | ||
'https://pureplate.site:443', # Allow from pureplate.site (https) on port 443 | ||
'http://www.pureplate.site:443', # Allow from pureplate.site (https) on port 443 | ||
'http://pureplate.site:443', # Allow from pureplate.site (https) on port 443 | ||
'http://localhost:3000', | ||
'http://127.0.0.1:3001', | ||
'https://www.pureplate.site:80' | ||
'https://pureplate.site:80' | ||
'http://www.pureplate.site:80' | ||
'http://pureplate.site:80' | ||
'https://www.pureplate.site:443' | ||
'https://pureplate.site:443' | ||
'http://www.pureplate.site:443' | ||
'http://pureplate.site:443' | ||
|
||
) | ||
|
||
CORS_ALLOW_METHODS = [ | ||
'DELETE', # Allow DELETE method | ||
'GET', # Allow GET method | ||
'OPTIONS', # Allow OPTIONS method | ||
'PATCH', # Allow PATCH method | ||
'POST', # Allow POST method | ||
'PUT', # Allow PUT method | ||
'DELETE', | ||
'GET', | ||
'OPTIONS', | ||
'PATCH', | ||
'POST', | ||
'PUT', | ||
] | ||
|
||
CORS_ALLOW_HEADERS = [ | ||
'accept', # Allow accept header | ||
'accept-encoding', # Allow accept-encoding header | ||
'authorization', # Allow authorization header | ||
'content-type', # Allow content-type header | ||
'accept', | ||
'accept-encoding', | ||
'authorization', | ||
'content-type', | ||
'dnt', | ||
'origin', | ||
'user-agent', | ||
'x-csrftoken', | ||
'x-requested-with', | ||
] | ||
|
||
ROOT_URLCONF = 'pure_plate.urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = 'pure_plate.wsgi.application' | ||
|
||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': BASE_DIR / 'db.sqlite3', | ||
} | ||
} | ||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
}, | ||
] | ||
|
||
|
||
REST_FRAMEWORK = { | ||
'DEFAULT_AUTHENTICATION_CLASSES': [ | ||
'rest_framework.authentication.TokenAuthentication', | ||
'rest_framework.authentication.SessionAuthentication', | ||
], | ||
'DEFAULT_PERMISSION_CLASSES': [ | ||
'rest_framework.permissions.AllowAny', | ||
] | ||
} | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/4.2/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
TIME_ZONE = 'Asia/Seoul' | ||
|
||
USE_I18N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/4.2/howto/static-files/ | ||
|
||
STATIC_URL = 'static/' | ||
|
||
# Default primary key field type | ||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field | ||
|
||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' | ||
|
||
AUTHENTICATION_BACKENDS = [ | ||
'account.backend.EmailBackend', | ||
'django.contrib.auth.backends.ModelBackend', | ||
] | ||
|
||
|
||
AUTH_USER_MODEL = 'account.User' | ||
|
||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': False, | ||
'handlers': { | ||
'file': { | ||
'level': 'DEBUG', | ||
'class': 'logging.FileHandler', | ||
'filename': 'debug.log', | ||
}, | ||
}, | ||
'loggers': { | ||
'django': { | ||
'handlers': ['file'], | ||
'level': 'DEBUG', | ||
'propagate': True, | ||
}, | ||
}, | ||
} |