From c5567596a67020ac61b9c2841d14c43a03fb1029 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sat, 18 Oct 2025 14:23:43 +0330 Subject: [PATCH] add redis to env files in project and coolugy --- .env.dev | 6 ++++++ .env.local | 8 +++++++- Rasaddam_Backend/settings.py | 18 ++++-------------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.env.dev b/.env.dev index bfcfd58..e2f0c57 100644 --- a/.env.dev +++ b/.env.dev @@ -13,5 +13,11 @@ DB_PASSWORD=pfLIVXupbDetvFMt2gUvxLXUL9b4HIOHaPcKXsBEZ1i8zl0iLUjmhUfXlGfJKcTV ENV RUNNING_IN_DOCKER=1 +CORS_ALLOWED_ORIGINS=http://localhost:8080,http://127.0.0.1:8080,http://127.0.0.1:3000,http://localhost:3000,http://192.168.88.130:3000,https://rasadyar.net,https://rasaddam-front.liara.run,https://dam.rasadyar.net,https://api.dam.rasadyar.com + +CELERY_BROKER_URL=rediss://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0 +CELERY_RESULT_BACKEND=rediss://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0 +CELERY_CACHE_BACKEND=default + # Super user information # SUPERUSER_EMAIL=superuser@example.com diff --git a/.env.local b/.env.local index 8fb72cf..4fe9361 100644 --- a/.env.local +++ b/.env.local @@ -11,7 +11,13 @@ DB_NAME=Development DB_USERNAME=postgres DB_PASSWORD=pfLIVXupbDetvFMt2gUvxLXUL9b4HIOHaPcKXsBEZ1i8zl0iLUjmhUfXlGfJKcTV -ENV RUNNING_IN_DOCKER=0 +ENV RUNNING_IN_DOCKER= + +CORS_ALLOWED_ORIGINS=http://localhost:8080,http://127.0.0.1:8080,http://127.0.0.1:3000,http://localhost:3000,http://192.168.88.130:3000,https://rasadyar.net,https://rasaddam-front.liara.run,https://dam.rasadyar.net,https://api.dam.rasadyar.com + +CELERY_BROKER_URL=rediss://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0 +CELERY_RESULT_BACKEND=rediss://default:wHM2fSW8EXtsoTjHxLZyyaRsD8IJm4tOU108252rizfmUYrp709PuCLUhr9mmYDK@31.7.78.133:14353/0 +CELERY_CACHE_BACKEND=default # Super user information # SUPERUSER_EMAIL=superuser@example.com diff --git a/Rasaddam_Backend/settings.py b/Rasaddam_Backend/settings.py index 16a15d2..b0c656e 100644 --- a/Rasaddam_Backend/settings.py +++ b/Rasaddam_Backend/settings.py @@ -159,13 +159,13 @@ SWAGGER_SETTINGS = { "DEFAULT_AUTO_SCHEMA_CLASS": "drf_yasg.inspectors.SwaggerAutoSchema" } -CELERY_BROKER_URL = "redis://:ydnW4hwzuDRYcTX3FWCHgQ1f@apo.liara.cloud:33740/0" # Requires Redis server +CELERY_BROKER_URL = os.environ.get("CELERY_BROKER_URL") accept_content = ["application/json"] result_serializer = "json" task_serializer = "json" timezone = "UTC" -CELERY_RESULT_BACKEND = "redis://:ydnW4hwzuDRYcTX3FWCHgQ1f@apo.liara.cloud:33740/0" -CELERY_CACHE_BACKEND = 'default' +CELERY_RESULT_BACKEND = os.environ.get("CELERY_RESULT_BACKEND") +CELERY_CACHE_BACKEND = os.environ.get("CELERY_CACHE_BACKEND") # Celery Beat settings CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler" @@ -341,17 +341,7 @@ DATA_UPLOAD_MAX_MEMORY_SIZE = 50242880 CORS_ORIGIN_ALLOW_ALL = False CORS_ALLOW_CREDENTIALS = True -CORS_ALLOWED_ORIGINS = ( - 'http://localhost:8080', - 'http://127.0.0.1:8080', - 'http://127.0.0.1:3000', - 'http://localhost:3000', - 'http://192.168.88.130:3000', - 'https://rasadyar.net', - 'https://rasaddam-front.liara.run', - 'https://dam.rasadyar.net', - 'http://ns0ck4ksk0koks8ksw0ss08g.31.7.78.133.sslip.io' # noqa -) +CORS_ALLOWED_ORIGINS = os.environ.get("CORS_ALLOWED_ORIGINS").split(",") SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_SSL_REDIRECT = False