config local env for debuging

This commit is contained in:
2025-10-18 12:07:47 +03:30
parent d4e14a1e51
commit 2f70581b34
6 changed files with 61 additions and 30 deletions

View File

@@ -12,7 +12,8 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
import os.path
from datetime import timedelta
from pathlib import Path
import os
from dotenv import load_dotenv
from django.conf import settings
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -21,27 +22,19 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
if not os.getenv("RUNNING_IN_DOCKER"):
dotenv_path = BASE_DIR / ".env.local"
load_dotenv(dotenv_path)
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-@0apn-lk85pfw=z00x2ib$w9#rwz8%2v4i_n^^9jz-m9b+y55*'
SECRET_KEY = os.environ.get("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = bool(os.environ.get("DEBUG", default=0))
ASGI_APPLICATION = "Rasaddam_Backend.asgi.application" # noqa
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
'https://rasadyar.net/',
'https://localhost:9200',
'https://api.rasadyaar.net',
'https://api.dam.rasadyaar.net',
'https://dam.rasadyar.net'
'http://localhost:3000',
'http://192.168.88.130:3000',
'https://rasaddam-front.liara.run',
'ns0ck4ksk0koks8ksw0ss08g.31.7.78.133.sslip.io' # noqa
]
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS").split(",")
# Application definition
@@ -129,13 +122,22 @@ MONGODB_DATABASES = {
}
DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': "postgres",
# 'HOST': "monte-rosa.liara.cloud",
# 'USER': "root",
# 'PASSWORD': "aFC3hqbxxR0SeBPZ6TCZ37my",
# 'PORT': '32718'
# },
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': "postgres",
'HOST': "monte-rosa.liara.cloud",
'USER': "root",
'PASSWORD': "aFC3hqbxxR0SeBPZ6TCZ37my",
'PORT': '32718'
'NAME': os.environ.get("DB_NAME"),
'HOST': os.environ.get("DB_HOST"),
'USER': os.environ.get("DB_USERNAME"),
'PASSWORD': os.environ.get("DB_PASSWORD"),
'PORT': os.environ.get("DB_PORT"),
},
}