superset/panoramix/__init__.py

34 lines
903 B
Python
Raw Normal View History

2015-07-15 13:12:32 -04:00
import logging
2015-09-11 18:32:42 -04:00
import os
2015-07-15 13:12:32 -04:00
from flask import Flask
2015-07-16 20:55:36 -04:00
from flask.ext.appbuilder import SQLA, AppBuilder, IndexView
2015-09-11 18:32:42 -04:00
from flask.ext.migrate import Migrate
from panoramix import config
2015-09-29 00:31:04 -04:00
2015-09-11 18:32:42 -04:00
APP_DIR = os.path.dirname(__file__)
2015-09-25 18:43:50 -04:00
CONFIG_MODULE = os.environ.get('PANORAMIX_CONFIG', 'panoramix.config')
2015-07-15 13:12:32 -04:00
2015-09-09 13:37:59 -04:00
# Logging configuration
2015-07-15 13:12:32 -04:00
logging.basicConfig(format='%(asctime)s:%(levelname)s:%(name)s:%(message)s')
logging.getLogger().setLevel(logging.DEBUG)
app = Flask(__name__)
2015-09-25 18:43:50 -04:00
app.config.from_object(CONFIG_MODULE)
2015-07-15 13:12:32 -04:00
db = SQLA(app)
2015-09-11 18:32:42 -04:00
migrate = Migrate(app, db, directory=APP_DIR + "/migrations")
2015-07-16 20:55:36 -04:00
2015-09-09 13:37:59 -04:00
2015-07-16 20:55:36 -04:00
class MyIndexView(IndexView):
index_template = 'index.html'
2015-07-15 13:12:32 -04:00
appbuilder = AppBuilder(
2015-07-16 20:55:36 -04:00
app, db.session, base_template='panoramix/base.html',
2015-09-11 18:32:42 -04:00
indexview=MyIndexView,
2015-09-25 18:43:50 -04:00
security_manager_class=app.config.get("CUSTOM_SECURITY_MANAGER"))
2015-07-15 13:12:32 -04:00
2015-09-29 00:31:04 -04:00
sm = appbuilder.sm
get_session = appbuilder.get_session
2015-09-05 12:23:46 -04:00
from panoramix import views