Mercurial > kallithea
comparison rhodecode/websetup.py @ 555:03676d39dd0a
added fault tolerant case when celeryconfig is not present in the directory.
small form fixes,
and websetup default app title and admin name
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 06 Oct 2010 18:26:59 +0200 |
parents | 2642f128ad46 |
children | 7ae66bddf48d |
comparison
equal
deleted
inserted
replaced
554:100b0aea57c2 | 555:03676d39dd0a |
---|---|
1 """Setup the rhodecode application""" | 1 """Setup the rhodecode application""" |
2 from os.path import dirname as dn, join as jn | |
3 from rhodecode.config.environment import load_environment | 2 from rhodecode.config.environment import load_environment |
4 from rhodecode.lib.db_manage import DbManage | 3 from rhodecode.lib.db_manage import DbManage |
5 import logging | 4 import logging |
6 import os | 5 import os |
7 import shutil | |
8 | 6 |
9 log = logging.getLogger(__name__) | 7 log = logging.getLogger(__name__) |
10 ROOT = dn(os.path.realpath(__file__)) | |
11 | 8 |
12 def setup_app(command, conf, vars): | 9 def setup_app(command, conf, vars): |
13 """Place any commands to setup rhodecode here""" | 10 """Place any commands to setup rhodecode here""" |
14 print dn(os.path.realpath(__file__)) | |
15 print(ROOT) | |
16 dbname = os.path.split(conf['sqlalchemy.db1.url'])[-1] | 11 dbname = os.path.split(conf['sqlalchemy.db1.url'])[-1] |
17 dbmanage = DbManage(log_sql=True, dbname=dbname, root=conf['here'], | 12 dbmanage = DbManage(log_sql=True, dbname=dbname, root=conf['here'], |
18 tests=False) | 13 tests=False) |
19 dbmanage.create_tables(override=True) | 14 dbmanage.create_tables(override=True) |
20 dbmanage.config_prompt(None) | 15 dbmanage.config_prompt(None) |
21 dbmanage.create_default_user() | 16 dbmanage.create_default_user() |
22 dbmanage.admin_prompt() | 17 dbmanage.admin_prompt() |
23 dbmanage.create_permissions() | 18 dbmanage.create_permissions() |
24 dbmanage.populate_default_permissions() | 19 dbmanage.populate_default_permissions() |
25 | 20 |
26 celeryconfig_file = 'celeryconfig.py' | 21 load_environment(conf.global_conf, conf.local_conf, initial=True) |
27 | |
28 celeryconfig_path = jn(ROOT, celeryconfig_file) | |
29 | |
30 | |
31 if not os.path.isfile(jn(conf['here'], celeryconfig_file)): | |
32 try: | |
33 shutil.copy(celeryconfig_path, conf['here']) | |
34 except IOError: | |
35 log.error('failed to copy celeryconfig.py from source %s ' | |
36 ' to this directory please copy it manually ', | |
37 celeryconfig_path) | |
38 else: | |
39 load_environment(conf.global_conf, conf.local_conf, initial=True) | |
40 | 22 |
41 | 23 |
42 | 24 |
43 | 25 |
44 | 26 |