aboutsummaryrefslogtreecommitdiff
path: root/rhodecode
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2010-10-06 15:37:23 +0200
committerMarcin Kuzminski <marcin@python-works.com>2010-10-06 15:37:23 +0200
commit2f28a5de6fb0af89039442279e2009a726ebf729 (patch)
treedc55f195da60ba8cf9f8b6555971561978c00e7e /rhodecode
parentd8d9aa98c90fb06275142bea69fd6658ecdbd16e (diff)
removed egg info, update files for distutils build
updated READMES some config files --HG-- rename : init.d/rhodecode_daemon => init.d/rhodecode-daemon rename : init.d/rhodecode_daemon2 => init.d/rhodecode-daemon2
Diffstat (limited to 'rhodecode')
-rw-r--r--rhodecode/config/deployment.ini_tmpl10
-rw-r--r--rhodecode/lib/db_manage.py22
-rw-r--r--rhodecode/lib/utils.py6
-rw-r--r--rhodecode/websetup.py42
4 files changed, 49 insertions, 31 deletions
diff --git a/rhodecode/config/deployment.ini_tmpl b/rhodecode/config/deployment.ini_tmpl
index 8a2d599c..2a33d443 100644
--- a/rhodecode/config/deployment.ini_tmpl
+++ b/rhodecode/config/deployment.ini_tmpl
@@ -1,6 +1,6 @@
################################################################################
################################################################################
-# rhodecode - Pylons environment configuration #
+# rhodecode - Pylons environment configuration #
# #
# The %(here)s variable will be replaced with the parent directory of this file#
################################################################################
@@ -9,8 +9,8 @@
debug = true
################################################################################
## Uncomment and replace with the address which should receive ##
-## any error reports after application crash ##
-## Additionally those settings will be used by rhodecode mailing system ##
+## any error reports after application crash ##
+## Additionally those settings will be used by rhodecode mailing system ##
################################################################################
#email_to = admin@localhost
#error_email_from = paste_error@localhost
@@ -35,12 +35,12 @@ use_threadpool = true
use = egg:Paste#http
host = 127.0.0.1
-port = 8001
+port = 5000
[app:main]
use = egg:rhodecode
full_stack = true
-static_files = false
+static_files = true
lang=en
cache_dir = %(here)s/data
app_instance_uuid = ${app_instance_uuid}
diff --git a/rhodecode/lib/db_manage.py b/rhodecode/lib/db_manage.py
index 3cf0ce0d..5559aec0 100644
--- a/rhodecode/lib/db_manage.py
+++ b/rhodecode/lib/db_manage.py
@@ -28,8 +28,6 @@ from os.path import dirname as dn, join as jn
import os
import sys
import uuid
-ROOT = dn(dn(dn(os.path.realpath(__file__))))
-sys.path.append(ROOT)
from rhodecode.lib.auth import get_crypt_password
from rhodecode.lib.utils import ask_ok
@@ -43,20 +41,22 @@ import logging
log = logging.getLogger(__name__)
class DbManage(object):
- def __init__(self, log_sql, dbname, tests=False):
+ def __init__(self, log_sql, dbname, root, tests=False):
self.dbname = dbname
self.tests = tests
- dburi = 'sqlite:////%s' % jn(ROOT, self.dbname)
+ self.root = root
+ dburi = 'sqlite:////%s' % jn(self.root, self.dbname)
engine = create_engine(dburi, echo=log_sql)
init_model(engine)
self.sa = meta.Session
self.db_exists = False
def check_for_db(self, override):
- log.info('checking for exisiting db')
- if os.path.isfile(jn(ROOT, self.dbname)):
+ db_path = jn(self.root, self.dbname)
+ log.info('checking for existing db in %s', db_path)
+ if os.path.isfile(db_path):
self.db_exists = True
- log.info('database exisist')
+ log.info('database exist')
if not override:
raise Exception('database already exists')
@@ -66,7 +66,7 @@ class DbManage(object):
"""
self.check_for_db(override)
if override:
- log.info("database exisist and it's going to be destroyed")
+ log.info("database exist and it's going to be destroyed")
if self.tests:
destroy = True
else:
@@ -74,7 +74,7 @@ class DbManage(object):
if not destroy:
sys.exit()
if self.db_exists and destroy:
- os.remove(jn(ROOT, self.dbname))
+ os.remove(jn(self.root, self.dbname))
checkfirst = not override
meta.Base.metadata.create_all(checkfirst=checkfirst)
log.info('Created tables for %s', self.dbname)
@@ -84,6 +84,10 @@ class DbManage(object):
import getpass
username = raw_input('Specify admin username:')
password = getpass.getpass('Specify admin password:')
+ confirm = getpass.getpass('Confirm password:')
+ if password != confirm:
+ log.error('passwords mismatch')
+ sys.exit()
email = raw_input('Specify admin email:')
self.create_user(username, password, email, True)
else:
diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py
index c4eeccdf..5dc8ac9f 100644
--- a/rhodecode/lib/utils.py
+++ b/rhodecode/lib/utils.py
@@ -467,9 +467,11 @@ def create_test_env(repos_test_path, config):
log.addHandler(ch)
#PART ONE create db
- log.debug('making test db')
+ log.debug('making test db in %s', repos_test_path)
dbname = config['sqlalchemy.db1.url'].split('/')[-1]
- dbmanage = DbManage(log_sql=True, dbname=dbname, tests=True)
+
+ dbmanage = DbManage(log_sql=True, dbname=dbname, root=config['here'],
+ tests=True)
dbmanage.create_tables(override=True)
dbmanage.config_prompt(repos_test_path)
dbmanage.create_default_user()
diff --git a/rhodecode/websetup.py b/rhodecode/websetup.py
index 041d6b5b..9bd3fdef 100644
--- a/rhodecode/websetup.py
+++ b/rhodecode/websetup.py
@@ -1,32 +1,44 @@
"""Setup the rhodecode application"""
-
-from os.path import dirname as dn
+from os.path import dirname as dn, join as jn
from rhodecode.config.environment import load_environment
from rhodecode.lib.db_manage import DbManage
import logging
import os
-import sys
+import shutil
log = logging.getLogger(__name__)
-
-ROOT = dn(dn(os.path.realpath(__file__)))
-sys.path.append(ROOT)
-
+ROOT = dn(os.path.realpath(__file__))
def setup_app(command, conf, vars):
"""Place any commands to setup rhodecode here"""
- log_sql = True
- tests = False
- REPO_TEST_PATH = None
-
+ print dn(os.path.realpath(__file__))
+ print(ROOT)
dbname = os.path.split(conf['sqlalchemy.db1.url'])[-1]
-
- dbmanage = DbManage(log_sql, dbname, tests)
+ dbmanage = DbManage(log_sql=True, dbname=dbname, root=conf['here'],
+ tests=False)
dbmanage.create_tables(override=True)
- dbmanage.config_prompt(REPO_TEST_PATH)
+ dbmanage.config_prompt(None)
dbmanage.create_default_user()
dbmanage.admin_prompt()
dbmanage.create_permissions()
dbmanage.populate_default_permissions()
- load_environment(conf.global_conf, conf.local_conf, initial=True)
+
+ celeryconfig_file = 'celeryconfig.py'
+
+ celeryconfig_path = jn(ROOT, celeryconfig_file)
+
+
+ if not os.path.isfile(jn(conf['here'], celeryconfig_file)):
+ try:
+ shutil.copy(celeryconfig_path, conf['here'])
+ except IOError:
+ log.error('failed to copy celeryconfig.py from source %s '
+ ' to this directory please copy it manually ',
+ celeryconfig_path)
+ else:
+ load_environment(conf.global_conf, conf.local_conf, initial=True)
+
+
+
+