generated from vignesh/searchengine
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 36s
189 lines
5.5 KiB
Python
189 lines
5.5 KiB
Python
"""
|
|
Django settings for config project.
|
|
|
|
Generated by 'django-admin startproject' using Django 6.1.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/6.1/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/6.1/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/6.1/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = 'django-insecure-!&om-o4k1p3t76*ordcwf9tuqo6j69jtt2r-u6jp$^@6h0$!kh'
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
|
|
import os
|
|
|
|
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '*').split(',') if os.environ.get('ALLOWED_HOSTS') else ['*']
|
|
|
|
CORS_ALLOW_ALL_ORIGINS = True
|
|
CORS_ALLOW_CREDENTIALS = True
|
|
CSRF_TRUSTED_ORIGINS = [
|
|
'https://betapayments.tradhox.com',
|
|
'https://beta.tradhox.com',
|
|
'https://tradhox.com',
|
|
'https://www.tradhox.com',
|
|
'http://localhost',
|
|
'http://localhost:5173',
|
|
'http://localhost:3000',
|
|
'http://127.0.0.1',
|
|
'http://127.0.0.1:5173',
|
|
'http://127.0.0.1:3000',
|
|
]
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'rest_framework',
|
|
'corsheaders',
|
|
'payments',
|
|
]
|
|
|
|
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',
|
|
]
|
|
|
|
ROOT_URLCONF = 'config.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [BASE_DIR / 'templates'],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.request',
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.contrib.messages.context_processors.messages',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'config.wsgi.application'
|
|
|
|
|
|
# Database Configuration (PostgreSQL)
|
|
# https://docs.djangoproject.com/en/6.1/ref/settings/#databases
|
|
|
|
db_host = os.environ.get('DB_HOST', '16.113.106.152')
|
|
db_port = os.environ.get('DB_PORT', '5432')
|
|
db_user = os.environ.get('DB_USER', 'vignesh')
|
|
db_pass = os.environ.get('DB_PASSWORD', 'vignesh_secret_pass_2026')
|
|
db_name = os.environ.get('DB_NAME', 'payments_beta')
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': db_name,
|
|
'USER': db_user,
|
|
'PASSWORD': db_pass,
|
|
'HOST': db_host,
|
|
'PORT': str(db_port),
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/6.1/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',
|
|
},
|
|
]
|
|
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/6.1/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/6.1/howto/static-files/
|
|
|
|
STATIC_URL = 'static/'
|
|
|
|
|
|
# Email
|
|
# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration
|
|
|
|
MAILERS = {
|
|
'default': {
|
|
'BACKEND': 'django.core.mail.backends.console.EmailBackend',
|
|
},
|
|
}
|
|
|
|
# Cashfree Payment Gateway Configuration
|
|
# Production API credentials (for requests originating from beta.tradhox.com & tradhox.com)
|
|
CASHFREE_PROD_APP_ID = os.environ.get('CASHFREE_PROD_APP_ID', '1370798f950e30514fa051e93868970731')
|
|
CASHFREE_PROD_SECRET_KEY = os.environ.get('CASHFREE_PROD_SECRET_KEY', 'cfsk_ma_prod_d441689923a71877068fee6b6e2e0d05_a626ee00')
|
|
|
|
# Sandbox / Test API credentials (for local testing and sandbox simulation)
|
|
CASHFREE_TEST_APP_ID = os.environ.get('CASHFREE_TEST_APP_ID', 'TEST1118017027fc875a9485063df8b007108111')
|
|
CASHFREE_TEST_SECRET_KEY = os.environ.get('CASHFREE_TEST_SECRET_KEY', 'cfsk_ma_test_3701af3af410228b8e707765dbb68c32_1cf9fb86')
|
|
|
|
# Default active fallback
|
|
CASHFREE_APP_ID = os.environ.get('CASHFREE_APP_ID', CASHFREE_PROD_APP_ID)
|
|
CASHFREE_SECRET_KEY = os.environ.get('CASHFREE_SECRET_KEY', CASHFREE_PROD_SECRET_KEY)
|
|
CASHFREE_ENVIRONMENT = os.environ.get('CASHFREE_ENVIRONMENT', 'sandbox') # 'sandbox' or 'production'
|
|
CASHFREE_API_VERSION = os.environ.get('CASHFREE_API_VERSION', '2023-08-01')
|
|
|
|
# Domains that trigger automatic Cashfree production API routing
|
|
TRADHOX_PRODUCTION_DOMAINS = [
|
|
'beta.tradhox.com',
|
|
'tradhox.com',
|
|
'www.tradhox.com',
|
|
'betapayments.tradhox.com',
|
|
'payments.tradhox.com',
|
|
]
|
|
|
|
if CASHFREE_ENVIRONMENT == 'production':
|
|
CASHFREE_BASE_URL = 'https://api.cashfree.com/pg'
|
|
else:
|
|
CASHFREE_BASE_URL = 'https://sandbox.cashfree.com/pg'
|
|
|
|
|