Fixed comand line of setuppostgress

This commit is contained in:
Cayo Puigdefabregas 2021-01-28 16:47:54 +01:00
parent c386b10bc8
commit a4c3b00205
1 changed files with 39 additions and 15 deletions

View File

@ -22,29 +22,53 @@ class Command(BaseCommand):
if defaults['ENGINE'] != 'django.db.backends.postgresql_psycopg2': if defaults['ENGINE'] != 'django.db.backends.postgresql_psycopg2':
defaults = {} defaults = {}
self.option_list = BaseCommand.option_list + ( def add_arguments(self, parser):
make_option('--db_name', dest='db_name', parser.add_argument(
default=defaults.get('DB_NAME', 'orchestra'), '--db_name',
help='Specifies the database to create.'), dest='db_name',
make_option('--db_user', dest='db_user', default=defaults.get('DB_NAME', 'orchestra2'),
help='Specifies the database to create.',
type=str
)
parser.add_argument(
'--db_user',
dest='db_user',
default=defaults.get('DB_USER', 'orchestra'), default=defaults.get('DB_USER', 'orchestra'),
help='Specifies the database to create.'), help='Specifies the database to create.',
make_option('--db_password', dest='db_password', type=str
)
parser.add_argument(
'--db_password',
dest='db_password',
default=defaults.get('PASSWORD', ''), default=defaults.get('PASSWORD', ''),
help='Specifies the database password, random if not specified.'), help='Specifies the database password, random if not specified.',
make_option('--db_host', dest='db_host', type=str
)
parser.add_argument(
'--db_host',
dest='db_host',
default=defaults.get('HOST', 'localhost'), default=defaults.get('HOST', 'localhost'),
help='Specifies the database to create.'), help='Specifies the database to create.',
make_option('--db_port', dest='db_port', type=str
)
parser.add_argument(
'--db_port',
dest='db_port',
default=defaults.get('PORT', '5432'), default=defaults.get('PORT', '5432'),
help='Specifies the database to create.'), help='Specifies the database to create.',
make_option('--noinput', action='store_false', dest='interactive', default=True, type=str
)
parser.add_argument(
'--noinput',
action='store_false',
dest='interactive',
default=True,
help='Tells Django to NOT prompt the user for input of any kind. ' help='Tells Django to NOT prompt the user for input of any kind. '
'You must use --username with --noinput, and must contain the ' 'You must use --username with --noinput, and must contain the '
'cleeryd process owner, which is the user how will perform tincd updates'), 'cleeryd process owner, which is the user how will perform tincd updates',
type=str
) )
option_list = BaseCommand.option_list
help = 'Setup PostgreSQL database.' help = 'Setup PostgreSQL database.'
def run_postgres(self, cmd, *args, **kwargs): def run_postgres(self, cmd, *args, **kwargs):