-
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy path__init__.py
More file actions
33 lines (22 loc) · 819 Bytes
/
__init__.py
File metadata and controls
33 lines (22 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Initialize Flask app."""
import uptrace
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
upclient = uptrace.Client(dsn="")
db = SQLAlchemy()
def create_app():
"""Construct the core application."""
app = Flask(__name__, instance_relative_config=False)
app.config.from_object("config.Config")
FlaskInstrumentor().instrument_app(app)
db.init_app(app)
with app.app_context():
from . import routes # Import routes
db.create_all() # Create database tables for our data models
SQLAlchemyInstrumentor().instrument(
engine=db.engine,
service="database",
)
return app