##// END OF EJS Templates
added fault tolerant case when celeryconfig is not present in the directory....
marcink -
r555:03676d39 default
parent child Browse files
Show More
@@ -1,6 +1,5 b''
1 from celery.decorators import task
1 from celery.decorators import task
2 from celery.task.sets import subtask
2
3 from celeryconfig import PYLONS_CONFIG as config
4 from operator import itemgetter
3 from operator import itemgetter
5 from pylons.i18n.translation import _
4 from pylons.i18n.translation import _
6 from rhodecode.lib.celerylib import run_task, locked_task
5 from rhodecode.lib.celerylib import run_task, locked_task
@@ -12,6 +11,14 b' from vcs.backends.hg import MercurialRep'
12 import json
11 import json
13 import traceback
12 import traceback
14
13
14 try:
15 from celeryconfig import PYLONS_CONFIG as config
16 except ImportError:
17 #if celeryconfig is not present let's just load our pylons
18 #config instead
19 from pylons import config
20
21
15 __all__ = ['whoosh_index', 'get_commits_stats',
22 __all__ = ['whoosh_index', 'get_commits_stats',
16 'reset_user_password', 'send_email']
23 'reset_user_password', 'send_email']
17
24
@@ -150,11 +150,11 b' class DbManage(object):'
150 hgsettings1 = RhodeCodeSettings()
150 hgsettings1 = RhodeCodeSettings()
151
151
152 hgsettings1.app_settings_name = 'realm'
152 hgsettings1.app_settings_name = 'realm'
153 hgsettings1.app_settings_value = 'rhodecode authentication'
153 hgsettings1.app_settings_value = 'RhodeCode authentication'
154
154
155 hgsettings2 = RhodeCodeSettings()
155 hgsettings2 = RhodeCodeSettings()
156 hgsettings2.app_settings_name = 'title'
156 hgsettings2.app_settings_name = 'title'
157 hgsettings2.app_settings_value = 'rhodecode'
157 hgsettings2.app_settings_value = 'RhodeCode'
158
158
159 try:
159 try:
160 self.sa.add(hooks1)
160 self.sa.add(hooks1)
@@ -177,7 +177,7 b' class DbManage(object):'
177 new_user = User()
177 new_user = User()
178 new_user.username = username
178 new_user.username = username
179 new_user.password = get_crypt_password(password)
179 new_user.password = get_crypt_password(password)
180 new_user.name = 'Hg'
180 new_user.name = 'RhodeCode'
181 new_user.lastname = 'Admin'
181 new_user.lastname = 'Admin'
182 new_user.email = email
182 new_user.email = email
183 new_user.admin = admin
183 new_user.admin = admin
@@ -260,7 +260,7 b' class LoginForm(formencode.Schema):'
260 not_empty=True,
260 not_empty=True,
261 messages={
261 messages={
262 'empty':_('Please enter a password'),
262 'empty':_('Please enter a password'),
263 'tooShort':_('Enter a value %(min)i characters long or more')}
263 'tooShort':_('Enter %(min)i characters or more')}
264 )
264 )
265
265
266
266
@@ -1,18 +1,13 b''
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)
@@ -22,21 +17,8 b' def setup_app(command, conf, vars):'
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
General Comments 0
You need to be logged in to leave comments. Login now