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

@@ -1,15 +1,17 @@
# Django secrets # Django secrets
SECRET_KEY=super-insecure-django-key SECRET_KEY=django-insecure-@0apn-lk85pfw=z00x2ib$w9#rwz8%2v4i_n^^9jz-m9b+y55*
DEBUG=True DEBUG=True
ALLOWED_HOSTS=* ALLOWED_HOSTS=localhost,127.0.0.1,https://rasadyar.net,https://localhost:9200,https://api.rasadyar.net,*.rasadyar.com,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
ENV_NAME=DEV ENV_NAME=DEV
# Datbase secrets # Database secrets
DB_HOST=localhost DB_HOST=31.7.78.133
DB_PORT=5432 DB_PORT=14352
DB_NAME=example_db DB_NAME=Development
DB_USERNAME=postgres DB_USERNAME=postgres
DB_PASSWORD=12345678 DB_PASSWORD=pfLIVXupbDetvFMt2gUvxLXUL9b4HIOHaPcKXsBEZ1i8zl0iLUjmhUfXlGfJKcTV
ENV RUNNING_IN_DOCKER=1
# Super user information # Super user information
SUPERUSER_EMAIL=superuser@example.com # SUPERUSER_EMAIL=superuser@example.com

17
.env.local Normal file
View File

@@ -0,0 +1,17 @@
# Django secrets
SECRET_KEY=django-insecure-@0apn-lk85pfw=z00x2ib$w9#rwz8%2v4i_n^^9jz-m9b+y55*
DEBUG=True
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
ENV_NAME=DEV
# Database secrets
DB_HOST=31.7.78.133
DB_PORT=14352
DB_NAME=Development
DB_USERNAME=postgres
DB_PASSWORD=pfLIVXupbDetvFMt2gUvxLXUL9b4HIOHaPcKXsBEZ1i8zl0iLUjmhUfXlGfJKcTV
ENV RUNNING_IN_DOCKER=0
# Super user information
# SUPERUSER_EMAIL=superuser@example.com

7
.idea/dataSources.xml generated
View File

@@ -8,5 +8,12 @@
<jdbc-url>jdbc:postgresql://monte-rosa.liara.cloud:32718/postgres</jdbc-url> <jdbc-url>jdbc:postgresql://monte-rosa.liara.cloud:32718/postgres</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir> <working-dir>$ProjectFileDir$</working-dir>
</data-source> </data-source>
<data-source source="LOCAL" name="Rasaddam Database" uuid="9aac63fe-b1bc-424a-837b-432d8d906a4c">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://31.7.78.133:14352/postgres</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component> </component>
</project> </project>

View File

@@ -12,7 +12,8 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
import os.path import os.path
from datetime import timedelta from datetime import timedelta
from pathlib import Path from pathlib import Path
import os
from dotenv import load_dotenv
from django.conf import settings from django.conf import settings
# Build paths inside the project like this: BASE_DIR / 'subdir'. # 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 # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/ # 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! # 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! # 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 ASGI_APPLICATION = "Rasaddam_Backend.asgi.application" # noqa
ALLOWED_HOSTS = [ ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS").split(",")
'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
]
# Application definition # Application definition
@@ -129,13 +122,22 @@ MONGODB_DATABASES = {
} }
DATABASES = { DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': "postgres",
# 'HOST': "monte-rosa.liara.cloud",
# 'USER': "root",
# 'PASSWORD': "aFC3hqbxxR0SeBPZ6TCZ37my",
# 'PORT': '32718'
# },
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': "postgres", 'NAME': os.environ.get("DB_NAME"),
'HOST': "monte-rosa.liara.cloud", 'HOST': os.environ.get("DB_HOST"),
'USER': "root", 'USER': os.environ.get("DB_USERNAME"),
'PASSWORD': "aFC3hqbxxR0SeBPZ6TCZ37my", 'PASSWORD': os.environ.get("DB_PASSWORD"),
'PORT': '32718' 'PORT': os.environ.get("DB_PORT"),
}, },
} }

View File

@@ -8,3 +8,5 @@ services:
- ./app/:/usr/src/app/ - ./app/:/usr/src/app/
ports: ports:
- "5000:5000" - "5000:5000"
env_file:
- ./.env.dev

View File

@@ -84,3 +84,4 @@ channels
channels_redis channels_redis
daphne daphne
django-jazzmin django-jazzmin
python-dotenv