Exemplo n.º 1
0
db = SQLAlchemy(app, session_options={'autocommit': True})

login_manager = LoginManager(app)
principals = Principal(app)

# Use nice error handlers for all common HTTP codes.
use_pretty_default_error_handlers(app)

from celerymethods.celery_manager import CeleryManager
cm = CeleryManager()
cm.start()

try:
    from celerymethods.tasks.tasks import Scheduler
    scheduler = Scheduler()
    scheduler.restore_tasks_to_db()
except Exception as e:
    app.logger.error("Error loading tasks to scheduler: '{0}'".format(str(e)))

from apimethods.system.cache import flush_cache
try:
    flush_cache(namespace='system_packages')
except Exception, msg:
    app.logger.warning("Error flushing system_packages namespace: %s" % (msg))

try:
    from api.lib.monitors.messages import initial_msg_load
    success, data = initial_msg_load()
    if not success:
        app.logger.warning("Messages couldn't be loaded in the database, %s" % str(data))
    else:
Exemplo n.º 2
0
db = SQLAlchemy(app, session_options={'autocommit': True})

login_manager = LoginManager(app)
principals = Principal(app)

# Use nice error handlers for all common HTTP codes.
use_pretty_default_error_handlers(app)

from celerymethods.celery_manager import CeleryManager
cm = CeleryManager()
cm.start()

try:
    from celerymethods.tasks.tasks import Scheduler
    scheduler = Scheduler()
    scheduler.restore_tasks_to_db()
except Exception as e:
    app.logger.error("Error loading tasks to scheduler: '{0}'".format(str(e)))

from apimethods.system.cache import flush_cache
try:
    flush_cache(namespace='system_packages')
except Exception, msg:
    app.logger.warning("Error flushing system_packages namespace: %s" % (msg))

try:
    from api.lib.monitors.messages import initial_msg_load
    success, data = initial_msg_load()
    if not success:
        app.logger.warning("Messages couldn't be loaded in the database, %s" %
                           str(data))