From 729c84e6ca617f9d6013a4db80485bb28b9cdfc1 Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Wed, 9 Nov 2016 08:51:19 -0200 Subject: [PATCH] =?UTF-8?q?Muda=20configura=C3=A7=C3=A3o=20de=20db=20do=20?= =?UTF-8?q?legacy=20para=20decouple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/legacy_migration_settings.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sapl/legacy_migration_settings.py b/sapl/legacy_migration_settings.py index aef9cc90b..0aab3baa9 100644 --- a/sapl/legacy_migration_settings.py +++ b/sapl/legacy_migration_settings.py @@ -1,19 +1,30 @@ -# Settings for data migration from mysql legacy to new postgres database +import os + +from decouple import Config, RepositoryEnv, AutoConfig +from dj_database_url import parse as db_url from .settings import * # flake8: noqa + +config = AutoConfig() +config.config = Config(RepositoryEnv(os.path.abspath('sapl/legacy/.env'))) + + INSTALLED_APPS += ( 'sapl.legacy', # legacy reversed model definitions ) -DATABASES['legacy'] = { +DATABASES['legacy'] = config('DATABASE_URL', cast=db_url,) + +"""DATABASES['legacy'] = { 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'sapl25', + 'NAME': 'legacy_interlegis', 'USER': 'root', - 'PASSWORD': 'admin', - 'HOST': 'localhost', # Or an IP Address that your DB is hosted on + 'PASSWORD': '', + 'HOST': '', # Or an IP Address that your DB is hosted on 'PORT': '3306', } +""" DATABASE_ROUTERS = ['sapl.legacy.router.LegacyRouter', ]