182 lines
5.1 KiB
Python
182 lines
5.1 KiB
Python
"""
|
|
Django settings for shippingservice_project project.
|
|
|
|
Generated by 'django-admin startproject' using Django 6.1.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/
|
|
"""
|
|
|
|
import os
|
|
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 = os.getenv('DJANGO_SECRET_KEY', 'django-insecure-sjt(lare3xpvbqfv$by71n6n5nx-94))6o(ew8*t9y$$&2aspa')
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = os.getenv('DJANGO_DEBUG', 'True').lower() in ['true', '1', 'yes']
|
|
|
|
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '*').split(',')
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'shipping',
|
|
'ekart',
|
|
'delhivery',
|
|
]
|
|
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
'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 = 'shippingservice_project.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'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 = 'shippingservice_project.wsgi.application'
|
|
|
|
|
|
import os
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/6.1/ref/settings/#databases
|
|
|
|
ENV = os.getenv('DJANGO_ENV', 'production').lower()
|
|
DB_NAME = 'shippingservice_prod'
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': os.getenv('DB_NAME', DB_NAME),
|
|
'USER': os.getenv('DB_USER', 'vignesh'),
|
|
'PASSWORD': os.getenv('DB_PASSWORD', 'vignesh_secret_pass_2026'),
|
|
'HOST': os.getenv('DB_HOST', '16.113.106.152'),
|
|
'PORT': os.getenv('DB_PORT', '5432'),
|
|
},
|
|
'beta': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': 'shippingservice_beta',
|
|
'USER': 'vignesh',
|
|
'PASSWORD': 'vignesh_secret_pass_2026',
|
|
'HOST': '16.113.106.152',
|
|
'PORT': '5432',
|
|
},
|
|
'prod': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': 'shippingservice_prod',
|
|
'USER': 'vignesh',
|
|
'PASSWORD': 'vignesh_secret_pass_2026',
|
|
'HOST': '16.113.106.152',
|
|
'PORT': '5432',
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
# 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_URL = '/static/'
|
|
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
|
STATICFILES_DIRS = [
|
|
BASE_DIR / 'shipping' / 'static',
|
|
]
|
|
|
|
|
|
# Email
|
|
# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration
|
|
|
|
MAILERS = {
|
|
'default': {
|
|
'BACKEND': 'django.core.mail.backends.console.EmailBackend',
|
|
},
|
|
}
|
|
|
|
# Shadowfax API Credentials & Endpoints
|
|
SFX_STAGING_TOKEN = os.getenv('SFX_STAGING_TOKEN', 'sample_staging_token_12345')
|
|
SFX_PRODUCTION_TOKEN = os.getenv('SFX_PRODUCTION_TOKEN', '7328f980a6eca01fedf37a63e39e44893481f856')
|
|
SFX_STAGING_BASE_URL = os.getenv('SFX_STAGING_BASE_URL', 'https://dale.shadowfax.in/api')
|
|
SFX_PRODUCTION_BASE_URL = os.getenv('SFX_PRODUCTION_BASE_URL', 'https://dale.shadowfax.in/api')
|
|
|
|
# Ekart API Credentials & Endpoints
|
|
EKART_BASE_URL = os.getenv('EKART_BASE_URL', 'https://app.elite.ekartlogistics.in')
|
|
EKART_CLIENT_ID = os.getenv('EKART_CLIENT_ID', 'sample_client_id')
|
|
EKART_USERNAME = os.getenv('EKART_USERNAME', 'sample_username')
|
|
EKART_PASSWORD = os.getenv('EKART_PASSWORD', 'sample_password')
|
|
|
|
# Webhook Verification Secrets
|
|
SFX_WEBHOOK_SECRET = os.getenv('SFX_WEBHOOK_SECRET', '')
|
|
EKART_WEBHOOK_SECRET = os.getenv('EKART_WEBHOOK_SECRET', '')
|
|
|
|
|
|
|
|
|
|
|