feat: optimizaciones UI/UX, Español, POO, CIA y Portabilidad Mac/Linux
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
# ========================================
|
||||||
|
# Variables de Entorno (Plantilla)
|
||||||
|
# ========================================
|
||||||
|
DEBUG=True
|
||||||
|
SECRET_KEY=django-insecure-r9n6j1_h%@uqoz0bjz^mq=t72o0t*j@84jpl%_i4^qu%&+**u7
|
||||||
|
ALLOWED_HOSTS=*
|
||||||
|
|
||||||
|
# === CONFIGURACIÓN LOCAL (Para usar start.sh sin Docker) ===
|
||||||
|
# Deja estas variables vacías o comentadas para usar SQLite y Memory Channel.
|
||||||
|
# DATABASE_URL=
|
||||||
|
# REDIS_URL=
|
||||||
|
|
||||||
|
# === CONFIGURACIÓN DOCKER (Descomentar para Producción/Docker) ===
|
||||||
|
# DATABASE_URL=postgres://efintel_user:efintel_password@db:5432/efintel_db
|
||||||
|
# REDIS_URL=redis://redis:6379/0
|
||||||
+2
-2
@@ -160,8 +160,8 @@ MAILERS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Celery Configuration
|
# Celery Configuration
|
||||||
CELERY_BROKER_URL = env('REDIS_URL', default='redis://localhost:6379/0')
|
CELERY_BROKER_URL = env('REDIS_URL', default='memory://')
|
||||||
CELERY_RESULT_BACKEND = env('REDIS_URL', default='redis://localhost:6379/0')
|
CELERY_RESULT_BACKEND = env('REDIS_URL', default='cache+memory://')
|
||||||
CELERY_ACCEPT_CONTENT = ['json']
|
CELERY_ACCEPT_CONTENT = ['json']
|
||||||
CELERY_TASK_SERIALIZER = 'json'
|
CELERY_TASK_SERIALIZER = 'json'
|
||||||
CELERY_RESULT_SERIALIZER = 'json'
|
CELERY_RESULT_SERIALIZER = 'json'
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
with open('config/settings.py', 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
# Replace CHANNEL_LAYERS
|
||||||
|
old_channels = """CHANNEL_LAYERS = {
|
||||||
|
"default": {
|
||||||
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||||
|
"CONFIG": {
|
||||||
|
"hosts": [env('REDIS_URL', default='redis://localhost:6379/0')],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}"""
|
||||||
|
new_channels = """REDIS_URL = env('REDIS_URL', default=None)
|
||||||
|
if REDIS_URL:
|
||||||
|
CHANNEL_LAYERS = {
|
||||||
|
"default": {
|
||||||
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||||
|
"CONFIG": {
|
||||||
|
"hosts": [REDIS_URL],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
CHANNEL_LAYERS = {
|
||||||
|
"default": {
|
||||||
|
"BACKEND": "channels.layers.InMemoryChannelLayer"
|
||||||
|
}
|
||||||
|
}"""
|
||||||
|
content = content.replace(old_channels, new_channels)
|
||||||
|
|
||||||
|
# Replace Celery defaults so they don't crash if REDIS_URL is None
|
||||||
|
old_celery1 = "CELERY_BROKER_URL = env('REDIS_URL', default='redis://localhost:6379/0')"
|
||||||
|
new_celery1 = "CELERY_BROKER_URL = env('REDIS_URL', default='memory://')"
|
||||||
|
old_celery2 = "CELERY_RESULT_BACKEND = env('REDIS_URL', default='redis://localhost:6379/0')"
|
||||||
|
new_celery2 = "CELERY_RESULT_BACKEND = env('REDIS_URL', default='cache+memory://')"
|
||||||
|
content = content.replace(old_celery1, new_celery1)
|
||||||
|
content = content.replace(old_celery2, new_celery2)
|
||||||
|
|
||||||
|
with open('config/settings.py', 'w') as f:
|
||||||
|
f.write(content)
|
||||||
Reference in New Issue
Block a user