From bf3e433665b94907057d6c8914077c94ed92b638 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 18 Nov 2012 15:48:56 -0300 Subject: added option database engine to askbot-setup script --- askbot/deployment/__init__.py | 24 ++++++++++++++++++++++-- askbot/doc/source/initial-configuration.rst | 2 ++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/askbot/deployment/__init__.py b/askbot/deployment/__init__.py index 59926cf4..de358f10 100644 --- a/askbot/deployment/__init__.py +++ b/askbot/deployment/__init__.py @@ -34,6 +34,16 @@ def askbot_setup(): help = "Directory where you want to install." ) + parser.add_option( + '-e', '--db-engine', + dest='database_engine', + action='store', + type='choice', + choices=('1', '2', '3'), + default=None, + help='Database engine, type 1 for postgresql, 2 for sqlite, 3 for mysql' + ) + parser.add_option( "-d", "--db-name", dest = "database_name", @@ -78,13 +88,14 @@ def askbot_setup(): try: options = parser.parse_args()[0] - #ask + #ask users to give missing parameters + #todo: make this more explicit here if options.verbosity >= 1: print messages.DEPLOY_PREAMBLE directory = path_utils.clean_directory(options.dir_name) while directory is None: - directory = path_utils.get_install_directory(force = options.force) + directory = path_utils.get_install_directory(force=options.force) deploy_askbot(directory, options) except KeyboardInterrupt: @@ -100,8 +111,17 @@ def deploy_askbot(directory, options): and the log file """ + database_engine_codes = { + 1: 'postgresql_psycopg2', + 2: 'sqlite3', + 3: 'mysql' + } + + database_engine = database_engine_codes[options.database_engine] + help_file = path_utils.get_path_to_help_file() context = { + 'database_engine': database_engine, 'database_name': options.database_name, 'database_password': options.database_password, 'database_user': options.database_user, diff --git a/askbot/doc/source/initial-configuration.rst b/askbot/doc/source/initial-configuration.rst index 7905aa1d..abef2e48 100644 --- a/askbot/doc/source/initial-configuration.rst +++ b/askbot/doc/source/initial-configuration.rst @@ -48,6 +48,8 @@ There may be an error message; ignore it. | -n | Name of the instance, this is the name that the | | | folder will use. | +----------------------------------+------------------------------------------------------------+ + | -e | Integer values: 1 - postgresql, 2 - sqlite3, 3 - mysql | + +----------------------------------+------------------------------------------------------------+ | -d | The database name that the instance will use. | +----------------------------------+------------------------------------------------------------+ | -u | The database user that the instance will use. | -- cgit v1.2.3-1-g7c22