diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-09-15 10:37:02 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-09-15 10:37:02 +0300 |
commit | 99de4563afa176e2610964f82b95904f03be7848 (patch) | |
tree | 6b14a7504a5e89f85f490a6f065d49ff34440762 /install.py | |
parent | 836de31b7b99c0308abe2ccf1617289b74a158bc (diff) | |
download | Servo-99de4563afa176e2610964f82b95904f03be7848.tar.gz Servo-99de4563afa176e2610964f82b95904f03be7848.tar.bz2 Servo-99de4563afa176e2610964f82b95904f03be7848.zip |
Added install.py
Diffstat (limited to 'install.py')
-rwxr-xr-x | install.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/install.py b/install.py new file mode 100755 index 0000000..0e9bbcb --- /dev/null +++ b/install.py @@ -0,0 +1,33 @@ +#! /usr/bin/env python + +import os +import socket +import requests +from string import Template +from subprocess import call + +args = {} +args['secret_key'] = os.urandom(32).encode('base-64').strip() +args['hostname'] = socket.gethostname() +args['install_country'] = raw_input('Country [SE]: ') or 'SE' +args['install_locale'] = raw_input('Locale [sv_SE.UTF-8]: ') or 'sv_SE.UTF-8' +args['install_language'] = raw_input('Language [sv]: ') or 'sv' +args['timezone'] = raw_input('Timezone [Europe/Stockholm]: ') or 'Europe/Stockholm' +args['install_id'] = raw_input('Installation ID [22]: ') or '22' + +args['dbhost'] = raw_input('Database host [localhost]: ') or 'localhost' +args['dbname'] = raw_input('Database [servo]: ') or 'servo' +args['dbuser'] = raw_input('DB user [servo]: ') or 'servo' +args['dbpwd'] = raw_input('DB password []: ') or '' + +tpl_url = 'https://gist.githubusercontent.com/filipp/cba2ffecd0d5790f7245/raw/' +raw = requests.get(tpl_url).text +template = Template(raw) + +s = template.substitute(**args) + +print s + +#call(['createuser', 'servo', '-U', 'pgsql']) +#call(['createdb', 'servo', '-O', 'servo', '-U', 'pgsql']) +#call(['manage.py'], 'createsuperuser') |