Browse Source

Muda configuração de db do legacy para decouple

pull/790/head
LeandroRoberto 8 years ago
parent
commit
729c84e6ca
  1. 21
      sapl/legacy_migration_settings.py

21
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 from .settings import * # flake8: noqa
config = AutoConfig()
config.config = Config(RepositoryEnv(os.path.abspath('sapl/legacy/.env')))
INSTALLED_APPS += ( INSTALLED_APPS += (
'sapl.legacy', # legacy reversed model definitions 'sapl.legacy', # legacy reversed model definitions
) )
DATABASES['legacy'] = { DATABASES['legacy'] = config('DATABASE_URL', cast=db_url,)
"""DATABASES['legacy'] = {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'NAME': 'sapl25', 'NAME': 'legacy_interlegis',
'USER': 'root', 'USER': 'root',
'PASSWORD': 'admin', 'PASSWORD': '',
'HOST': 'localhost', # Or an IP Address that your DB is hosted on 'HOST': '', # Or an IP Address that your DB is hosted on
'PORT': '3306', 'PORT': '3306',
} }
"""
DATABASE_ROUTERS = ['sapl.legacy.router.LegacyRouter', ] DATABASE_ROUTERS = ['sapl.legacy.router.LegacyRouter', ]

Loading…
Cancel
Save