File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from .aws_settings import *
2+
3+ import os
4+ from django .core .exceptions import ImproperlyConfigured
5+
6+ DB_OVERRIDES = dict (
7+ PASSWORD = os .environ .get ('DB_MIGRATION_PASS' , None ),
8+ ENGINE = os .environ .get ('DB_MIGRATION_ENGINE' , DATABASES ['default' ]['ENGINE' ]),
9+ USER = os .environ .get ('DB_MIGRATION_USER' , DATABASES ['default' ]['USER' ]),
10+ NAME = os .environ .get ('DB_MIGRATION_NAME' , DATABASES ['default' ]['NAME' ]),
11+ HOST = os .environ .get ('DB_MIGRATION_HOST' , DATABASES ['default' ]['HOST' ]),
12+ PORT = os .environ .get ('DB_MIGRATION_PORT' , DATABASES ['default' ]['PORT' ]),
13+ )
14+
15+ if DB_OVERRIDES ['PASSWORD' ] is None :
16+ raise ImproperlyConfigured ("No database password was provided for running "
17+ "migrations. This is fatal." )
18+
19+ for override , value in DB_OVERRIDES .iteritems ():
20+ DATABASES ['default' ][override ] = value
You can’t perform that action at this time.
0 commit comments