Skip to content

Commit d122374

Browse files
Refactor database settings and remove Railway config
1 parent 1ffd954 commit d122374

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

argus_ia/settings.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,19 @@
5656

5757
# Database Configuration
5858
# DATABASES
59-
import dj_database_url
60-
61-
# Database
6259
DATABASES = {
63-
'default': dj_database_url.config(
64-
default='sqlite:///db.sqlite3', # Fallback para desenvolvimento
60+
'default': {
61+
'ENGINE': 'django.db.backends.sqlite3',
62+
'NAME': BASE_DIR / 'db.sqlite3',
63+
}
64+
}
65+
66+
if 'DATABASE_URL' in os.environ:
67+
import dj_database_url
68+
DATABASES['default'] = dj_database_url.config(
6569
conn_max_age=600,
66-
conn_health_checks=True,
67-
ssl_require=True
70+
ssl_require=False
6871
)
69-
}
7072

7173
# Password validation
7274
AUTH_PASSWORD_VALIDATORS = [
@@ -114,17 +116,6 @@
114116
'https://*.railway.app'
115117
]
116118

117-
# Porta dinâmica para Railway
118-
if 'RAILWAY_ENVIRONMENT' in os.environ or 'DATABASE_URL' in os.environ:
119-
# Configurações específicas para produção no Railway
120-
import django_heroku
121-
django_heroku.settings(locals(), databases=False)
122-
123-
# Ajuste ALLOWED_HOSTS dinamicamente
124-
railway_app_name = os.environ.get('RAILWAY_STATIC_URL', '').replace('https://', '').replace('http://', '')
125-
if railway_app_name:
126-
ALLOWED_HOSTS.append(railway_app_name)
127-
128119
# if not DEBUG:
129120
# SECURE_SSL_REDIRECT = True
130121
# SESSION_COOKIE_SECURE = True

0 commit comments

Comments
 (0)