summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-11-18 15:48:56 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-11-18 15:48:56 -0300
commitbf3e433665b94907057d6c8914077c94ed92b638 (patch)
treeba5136a254bca5ea4e5e9eeeeef44248621802c2
parent0dccc47d7d74c8bd180438f5428ac1a9db041558 (diff)
downloadaskbot-bf3e433665b94907057d6c8914077c94ed92b638.tar.gz
askbot-bf3e433665b94907057d6c8914077c94ed92b638.tar.bz2
askbot-bf3e433665b94907057d6c8914077c94ed92b638.zip
added option database engine to askbot-setup script
-rw-r--r--askbot/deployment/__init__.py24
-rw-r--r--askbot/doc/source/initial-configuration.rst2
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
@@ -35,6 +35,16 @@ def askbot_setup():
)
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",
default = None,
@@ -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> | Name of the instance, this is the name that the |
| | folder will use. |
+----------------------------------+------------------------------------------------------------+
+ | -e <DATABASE_ENGINE> | Integer values: 1 - postgresql, 2 - sqlite3, 3 - mysql |
+ +----------------------------------+------------------------------------------------------------+
| -d <DATABASE_NAME> | The database name that the instance will use. |
+----------------------------------+------------------------------------------------------------+
| -u <DATABASE_USER> | The database user that the instance will use. |