db: Move database initialization up to pyramid.
We need the DB during app setup. Therefore we have to move this up to the make_pyramid_app function.
This commit is contained in:
parent
7f133e9332
commit
35f714fa77
2 changed files with 6 additions and 5 deletions
|
|
@ -145,10 +145,6 @@ def load_environment(global_conf, app_conf, initial=False,
|
|||
protocol=utils.get_vcs_server_protocol(config),
|
||||
log_level=config['vcs.server.log_level'])
|
||||
|
||||
# MULTIPLE DB configs
|
||||
# Setup the SQLAlchemy database engine
|
||||
utils.initialize_database(config)
|
||||
|
||||
set_available_permissions(config)
|
||||
db_cfg = make_db_config(clear_session=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ from routes.middleware import RoutesMiddleware
|
|||
import routes.util
|
||||
|
||||
import rhodecode
|
||||
from rhodecode.config import patches
|
||||
from rhodecode.config import patches, utils
|
||||
from rhodecode.config.environment import load_environment
|
||||
from rhodecode.lib.middleware import csrf
|
||||
from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
|
||||
|
|
@ -157,6 +157,11 @@ def make_pyramid_app(global_config, **settings):
|
|||
# behavior in the old application.
|
||||
settings_pylons = settings.copy()
|
||||
|
||||
# TODO: Remove this by refactoring the init DB function.
|
||||
# Put debug flag into settings for DB setup.
|
||||
settings['debug'] = global_config.get('debug', False)
|
||||
utils.initialize_database(settings)
|
||||
|
||||
sanitize_settings_and_apply_defaults(settings)
|
||||
config = Configurator(settings=settings)
|
||||
add_pylons_compat_data(config.registry, global_config, settings_pylons)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue