inital db
This commit is contained in:
commit
a3b496744c
12 changed files with 508 additions and 0 deletions
32
app/__init__.py
Normal file
32
app/__init__.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import logging
|
||||
|
||||
from flask import Flask
|
||||
from flask_appbuilder import AppBuilder, SQLA
|
||||
|
||||
"""
|
||||
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")
|
||||
db = SQLA(app)
|
||||
appbuilder = AppBuilder(app, db.session)
|
||||
|
||||
|
||||
"""
|
||||
from sqlalchemy.engine import Engine
|
||||
from sqlalchemy import event
|
||||
|
||||
#Only include this for SQLLite constraints
|
||||
@event.listens_for(Engine, "connect")
|
||||
def set_sqlite_pragma(dbapi_connection, connection_record):
|
||||
# Will force sqllite contraint foreign keys
|
||||
cursor = dbapi_connection.cursor()
|
||||
cursor.execute("PRAGMA foreign_keys=ON")
|
||||
cursor.close()
|
||||
"""
|
||||
|
||||
from . import views
|
||||
Loading…
Add table
Add a link
Reference in a new issue