chore: update CORS and ALLOWED_HOSTS settings
This commit is contained in:
parent
7c96da524b
commit
0618afbbea
2 changed files with 25 additions and 21 deletions
|
|
@ -21,24 +21,29 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
|
||||||
SECRET_KEY = 'django-insecure-9)^^*tvi%nrcooazhtd&s*9@capcuv5j0u_9+))s-#2q@uw+%s'
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = [
|
ALLOWED_HOSTS = [
|
||||||
|
'join.andre-kempf.com',
|
||||||
|
'join-api.andre-kempf.com',
|
||||||
|
'45.157.177.172',
|
||||||
'localhost',
|
'localhost',
|
||||||
'127.0.0.1',
|
'127.0.0.1',
|
||||||
]
|
]
|
||||||
|
|
||||||
# CORS settings
|
# CORS settings
|
||||||
CORS_ALLOWED_ORIGINS = ['http://localhost:4200']
|
|
||||||
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS = [
|
||||||
|
'https://45.157.177.172',
|
||||||
|
'https://join.andre-kempf.com',
|
||||||
|
'http://localhost:4200']
|
||||||
|
|
||||||
CORS_ALLOW_HEADERS = [
|
CORS_ALLOW_HEADERS = [
|
||||||
'content-type', 'accept', 'authorization', 'x-csrftoken', 'sentry-trace', 'baggage',
|
'content-type', 'accept', 'authorization', 'x-csrftoken', 'sentry-trace', 'baggage',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Application config
|
# Application config
|
||||||
|
|
||||||
AUTH_USER_MODEL = 'user_app.User'
|
AUTH_USER_MODEL = 'user_app.User'
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
|
@ -58,6 +63,7 @@ INSTALLED_APPS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
'corsheaders.middleware.CorsMiddleware',
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
|
@ -65,7 +71,6 @@ MIDDLEWARE = [
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'corsheaders.middleware.CorsMiddleware',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'join.urls'
|
ROOT_URLCONF = 'join.urls'
|
||||||
|
|
@ -97,23 +102,16 @@ CACHES = {
|
||||||
'BACKEND': 'django_redis.cache.RedisCache',
|
'BACKEND': 'django_redis.cache.RedisCache',
|
||||||
'LOCATION': 'redis://127.0.0.1:6379/1',
|
'LOCATION': 'redis://127.0.0.1:6379/1',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
|
'PASSWORD': 'foobared',
|
||||||
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
|
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
|
||||||
}
|
},
|
||||||
|
'KEY_PREFIX': 'joinapi',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
||||||
|
|
||||||
"""
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
|
|
@ -159,7 +157,9 @@ USE_TZ = True
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = 'static/'
|
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
||||||
|
|
@ -199,10 +199,12 @@ REST_FRAMEWORK = {
|
||||||
|
|
||||||
env = Env()
|
env = Env()
|
||||||
Env.read_env()
|
Env.read_env()
|
||||||
|
|
||||||
DEBUG = env.bool('DEBUG', default=False)
|
DEBUG = env.bool('DEBUG', default=False)
|
||||||
SECRET_KEY = env('SECRET_KEY')
|
SECRET_KEY = env('SECRET_KEY')
|
||||||
|
|
||||||
# EMAIL
|
# Mail
|
||||||
|
|
||||||
EMAIL_USE_TLS = True
|
EMAIL_USE_TLS = True
|
||||||
EMAIL_HOST = 'smtp.gmail.com'
|
EMAIL_HOST = 'smtp.gmail.com'
|
||||||
EMAIL_PORT = 587
|
EMAIL_PORT = 587
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ django-environ==0.12.0
|
||||||
django-redis==5.4.0
|
django-redis==5.4.0
|
||||||
djangorestframework==3.15.2
|
djangorestframework==3.15.2
|
||||||
djangorestframework-camel-case==1.4.2
|
djangorestframework-camel-case==1.4.2
|
||||||
|
gunicorn==23.0.0
|
||||||
psycopg2==2.9.10
|
psycopg2==2.9.10
|
||||||
|
psycopg2-binary==2.9.10
|
||||||
redis==5.2.1
|
redis==5.2.1
|
||||||
sqlparse==0.5.3
|
sqlparse==0.5.3
|
||||||
Loading…
Reference in a new issue