2016-03-18 02:44:58 -04:00
|
|
|
"""Package's main module!"""
|
2016-04-07 11:39:08 -04:00
|
|
|
from __future__ import absolute_import
|
|
|
|
from __future__ import division
|
|
|
|
from __future__ import print_function
|
|
|
|
from __future__ import unicode_literals
|
2016-03-18 02:44:58 -04:00
|
|
|
|
|
|
|
import logging
|
|
|
|
import os
|
2016-04-08 02:01:40 -04:00
|
|
|
|
2016-03-18 02:44:58 -04:00
|
|
|
from flask import Flask, redirect
|
|
|
|
from flask.ext.appbuilder import SQLA, AppBuilder, IndexView
|
|
|
|
from flask.ext.appbuilder.baseviews import expose
|
2016-03-16 23:25:41 -04:00
|
|
|
from flask.ext.cache import Cache
|
2016-04-08 02:01:40 -04:00
|
|
|
from flask.ext.migrate import Migrate
|
2016-03-18 02:44:58 -04:00
|
|
|
|
2016-04-14 01:45:50 -04:00
|
|
|
VERSION = '0.8.7'
|
2016-04-13 20:27:20 -04:00
|
|
|
|
2016-03-18 02:44:58 -04:00
|
|
|
APP_DIR = os.path.dirname(__file__)
|
2016-03-29 00:55:58 -04:00
|
|
|
CONFIG_MODULE = os.environ.get('CARAVEL_CONFIG', 'caravel.config')
|
2016-03-18 02:44:58 -04:00
|
|
|
|
|
|
|
# Logging configuration
|
|
|
|
logging.basicConfig(format='%(asctime)s:%(levelname)s:%(name)s:%(message)s')
|
|
|
|
logging.getLogger().setLevel(logging.DEBUG)
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
app.config.from_object(CONFIG_MODULE)
|
|
|
|
db = SQLA(app)
|
2016-03-16 23:25:41 -04:00
|
|
|
|
|
|
|
cache = Cache(app, config=app.config.get('CACHE_CONFIG'))
|
|
|
|
|
2016-03-18 02:44:58 -04:00
|
|
|
migrate = Migrate(app, db, directory=APP_DIR + "/migrations")
|
|
|
|
|
|
|
|
|
|
|
|
class MyIndexView(IndexView):
|
|
|
|
@expose('/')
|
|
|
|
def index(self):
|
2016-03-29 00:55:58 -04:00
|
|
|
return redirect('/caravel/welcome')
|
2016-03-18 02:44:58 -04:00
|
|
|
|
|
|
|
appbuilder = AppBuilder(
|
|
|
|
app, db.session,
|
2016-03-29 00:55:58 -04:00
|
|
|
base_template='caravel/base.html',
|
2016-03-18 02:44:58 -04:00
|
|
|
indexview=MyIndexView,
|
|
|
|
security_manager_class=app.config.get("CUSTOM_SECURITY_MANAGER"))
|
|
|
|
|
|
|
|
sm = appbuilder.sm
|
|
|
|
|
|
|
|
get_session = appbuilder.get_session
|
2016-03-29 00:55:58 -04:00
|
|
|
from caravel import config, views # noqa
|