Changeset - ea1c608efa3a
[Not reviewed]
default
1 1 1
Mads Kiilerich (mads) - 5 years ago 2020-11-07 18:49:57
mads@kiilerich.com
Grafted from: 71b67e962be0
celery: rename celerypylons to more descriptive celery_app

This module is all about creating a Celery app.
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/config/app_cfg.py
Show inline comments
 
@@ -12,49 +12,49 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
Global configuration file for TurboGears2 specific settings in Kallithea.
 

	
 
This file complements the .ini file.
 
"""
 

	
 
import logging
 
import os
 
import platform
 
import sys
 

	
 
import alembic.config
 
import mercurial
 
import tg
 
from alembic.migration import MigrationContext
 
from alembic.script.base import ScriptDirectory
 
from sqlalchemy import create_engine
 
from tg import FullStackApplicationConfigurator
 

	
 
import kallithea.lib.locales
 
import kallithea.model.base
 
import kallithea.model.meta
 
from kallithea.lib import celerypylons
 
from kallithea.lib import celery_app
 
from kallithea.lib.utils import load_extensions, set_app_settings, set_indexer_config, set_vcs_config
 
from kallithea.lib.utils2 import asbool, check_git_version
 
from kallithea.model import db
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
base_config = FullStackApplicationConfigurator()
 

	
 
base_config.update_blueprint({
 
    'package': kallithea,
 

	
 
    # Rendering Engines Configuration
 
    'renderers': [
 
        'json',
 
        'mako',
 
    ],
 
    'default_renderer': 'mako',
 
    'use_dotted_templatenames': False,
 

	
 
    # Configure Sessions, store data as JSON to avoid pickle security issues
 
    'session.enabled': True,
 
    'session.data_serializer': 'json',
 
@@ -115,49 +115,49 @@ def setup_configuration(app):
 
        alembic_cfg = alembic.config.Config()
 
        alembic_cfg.set_main_option('script_location', 'kallithea:alembic')
 
        alembic_cfg.set_main_option('sqlalchemy.url', dbconf)
 
        script_dir = ScriptDirectory.from_config(alembic_cfg)
 
        available_heads = sorted(script_dir.get_heads())
 

	
 
        engine = create_engine(dbconf)
 
        with engine.connect() as conn:
 
            context = MigrationContext.configure(conn)
 
            current_heads = sorted(str(s) for s in context.get_current_heads())
 
        if current_heads != available_heads:
 
            log.error('Failed to run Kallithea:\n\n'
 
                      'The database version does not match the Kallithea version.\n'
 
                      'Please read the documentation on how to upgrade or downgrade the database.\n'
 
                      'Current database version id(s): %s\n'
 
                      'Expected database version id(s): %s\n'
 
                      'If you are a developer and you know what you are doing, you can add `ignore_alembic_revision = True` '
 
                      'to your .ini file to skip the check.\n' % (' '.join(current_heads), ' '.join(available_heads)))
 
            sys.exit(1)
 

	
 
    # store some globals into kallithea
 
    kallithea.DEFAULT_USER_ID = db.User.get_default_user().user_id
 

	
 
    if asbool(config.get('use_celery')):
 
        kallithea.CELERY_APP = celerypylons.make_app()
 
        kallithea.CELERY_APP = celery_app.make_celery_app()
 
    kallithea.CONFIG = config
 

	
 
    load_extensions(root_path=config['here'])
 

	
 
    set_app_settings(config)
 

	
 
    instance_id = kallithea.CONFIG.get('instance_id', '*')
 
    if instance_id == '*':
 
        instance_id = '%s-%s' % (platform.uname()[1], os.getpid())
 
        kallithea.CONFIG['instance_id'] = instance_id
 

	
 
    # update kallithea.CONFIG with the meanwhile changed 'config'
 
    kallithea.CONFIG.update(config)
 

	
 
    # configure vcs and indexer libraries (they are supposed to be independent
 
    # as much as possible and thus avoid importing tg.config or
 
    # kallithea.CONFIG).
 
    set_vcs_config(kallithea.CONFIG)
 
    set_indexer_config(kallithea.CONFIG)
 

	
 
    check_git_version()
 

	
 
    kallithea.model.meta.Session.remove()
 

	
kallithea/lib/celery_app.py
Show inline comments
 
file renamed from kallithea/lib/celerypylons/__init__.py to kallithea/lib/celery_app.py
0 comments (0 inline, 0 general)