Skip to content

Commit

Permalink
fix: init
Browse files Browse the repository at this point in the history
  • Loading branch information
alguadam committed Oct 1, 2023
1 parent 0b3fefa commit d50c3c2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions iebank_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from flask_cors import CORS
from dotenv import load_dotenv
import os
from applicationinsights.flask.ext import AppInsights

app = Flask(__name__)

Expand All @@ -22,11 +23,20 @@
print("Running in production mode")
app.config.from_object('config.ProductionConfig')


db = SQLAlchemy(app)

from iebank_api.models import Account
db.create_all()

with app.app_context():
db.create_all()
CORS(app)

from iebank_api import routes
from iebank_api import routes

# Initialize Application Insights and force flushing application insights handler after each request
if('ENV' != 'ghci'):
appinsights = AppInsights(app)
@app.after_request
def after_request(response):
appinsights.flush()
return response

0 comments on commit d50c3c2

Please sign in to comment.