Example #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()
Example #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()
Example #3
0
 def setUp(self):
   # Hack to set up the template folder properly.
   template_dir = os.path.dirname(__file__) + "/../../yaka/templates"
   template_dir = os.path.normpath(template_dir)
   self.app = Flask(__name__, template_folder=template_dir)
   babel.init_app(self.app)