Beispiel #1
0
    def __init__(self, config):
        Flask.__init__(self, __name__)

        # TODO: deal with envvar and pyfile
        self.config.from_object(config)

        # Initialise helpers and services
        db.init_app(self)
        mail.init_app(self)

        # Babel (for i18n)
        babel.init_app(self)
        babel.localeselector(get_locale)

        # celery async service
        celery.config_from_object(config)

        # Initialise filters
        init_filters(self)
        # init_auth(self)

        self.register_services()
Beispiel #2
0
  def __init__(self, config):
    Flask.__init__(self, __name__)

    # TODO: deal with envvar and pyfile
    self.config.from_object(config)

    # Initialise helpers and services
    db.init_app(self)
    mail.init_app(self)

    # Babel
    babel.init_app(self)
    babel.localeselector(get_locale)

    # DEBUG
    self.jinja_env.add_extension('jinja2.ext.i18n')
    self.jinja_env.install_gettext_callables(
      lambda x: x,
      lambda s, p, n: p,
      newstyle=True
    )



  # Assets (bundles are defined in the templates)
    assets = Environment(self)

    # Initialise filters
    init_filters(self)
    init_auth(self)

    from .apps.crm.frontend import CRM
    crm = CRM(self)

    self.register_blueprints()

    # Must come after all entity classes have been declared.
    self.register_services()