From 11e9f35220017062d2d09649354174c955f3caa0 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Fri, 6 May 2016 15:37:15 +0300 Subject: Prompt for dbadmin --- install.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/install.py b/install.py index 60170c0..9d12b45 100755 --- a/install.py +++ b/install.py @@ -13,6 +13,7 @@ fh = open('local_settings.py', 'w') print("** Creating local configuration file **") args = {} +args['dbadmin'] = raw_input('DB admin username [pgsql]: ') or 'pgsql' args['secret_key'] = os.urandom(32).encode('base-64').strip() args['install_locale'] = raw_input('1/10 Locale [sv_SE.UTF-8]: ') or 'sv_SE.UTF-8' default_country = args['install_locale'].split('_')[0] @@ -32,8 +33,8 @@ template = Template(raw) s = template.substitute(**args) -call(['createuser', args['dbuser'], '-U', 'pgsql']) -call(['createdb', args['dbname'], '-O', args['dbuser'], '-U', 'pgsql']) +call(['createuser', args['dbuser'], '-U', args['dbadmin']]) +call(['createdb', args['dbname'], '-O', args['dbuser'], '-U', args['dbadmin']]) fh.write(s) fh.close() @@ -41,8 +42,8 @@ fh.close() loc = {} print("** Setting up database tables **") -call(['./manage.py', 'migrate', '--no-initial-data']) -call(['psql', '-c', 'ALTER SEQUENCE servo_order_id_seq RESTART WITH 12345']) +call(['./manage.py', 'migrate']) +call(['psql', '-c', 'ALTER SEQUENCE servo_order_id_seq RESTART WITH 12345', args['dbname'], args['dbuser']]) print("** Creating Super User **") call(['./manage.py', 'createsuperuser']) -- cgit v1.2.3