##// 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 1 from celery.decorators import task
2 from celery.task.sets import subtask
3 from celeryconfig import PYLONS_CONFIG as config
2
4 3 from operator import itemgetter
5 4 from pylons.i18n.translation import _
6 5 from rhodecode.lib.celerylib import run_task, locked_task
@@ -12,6 +11,14 b' from vcs.backends.hg import MercurialRep'
12 11 import json
13 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 22 __all__ = ['whoosh_index', 'get_commits_stats',
16 23 'reset_user_password', 'send_email']
17 24
@@ -150,11 +150,11 b' class DbManage(object):'
150 150 hgsettings1 = RhodeCodeSettings()
151 151
152 152 hgsettings1.app_settings_name = 'realm'
153 hgsettings1.app_settings_value = 'rhodecode authentication'
153 hgsettings1.app_settings_value = 'RhodeCode authentication'
154 154
155 155 hgsettings2 = RhodeCodeSettings()
156 156 hgsettings2.app_settings_name = 'title'
157 hgsettings2.app_settings_value = 'rhodecode'
157 hgsettings2.app_settings_value = 'RhodeCode'
158 158
159 159 try:
160 160 self.sa.add(hooks1)
@@ -177,7 +177,7 b' class DbManage(object):'
177 177 new_user = User()
178 178 new_user.username = username
179 179 new_user.password = get_crypt_password(password)
180 new_user.name = 'Hg'
180 new_user.name = 'RhodeCode'
181 181 new_user.lastname = 'Admin'
182 182 new_user.email = email
183 183 new_user.admin = admin
@@ -260,7 +260,7 b' class LoginForm(formencode.Schema):'
260 260 not_empty=True,
261 261 messages={
262 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 1 """Setup the rhodecode application"""
2 from os.path import dirname as dn, join as jn
3 2 from rhodecode.config.environment import load_environment
4 3 from rhodecode.lib.db_manage import DbManage
5 4 import logging
6 5 import os
7 import shutil
8 6
9 7 log = logging.getLogger(__name__)
10 ROOT = dn(os.path.realpath(__file__))
11 8
12 9 def setup_app(command, conf, vars):
13 10 """Place any commands to setup rhodecode here"""
14 print dn(os.path.realpath(__file__))
15 print(ROOT)
16 11 dbname = os.path.split(conf['sqlalchemy.db1.url'])[-1]
17 12 dbmanage = DbManage(log_sql=True, dbname=dbname, root=conf['here'],
18 13 tests=False)
@@ -22,21 +17,8 b' def setup_app(command, conf, vars):'
22 17 dbmanage.admin_prompt()
23 18 dbmanage.create_permissions()
24 19 dbmanage.populate_default_permissions()
25
26 celeryconfig_file = 'celeryconfig.py'
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)
20
21 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