-
Notifications
You must be signed in to change notification settings - Fork 12
/
config.py
28 lines (21 loc) · 853 Bytes
/
config.py
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
import os
import connexion
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
from flask_jwt_extended import JWTManager
basedir = os.path.abspath(os.path.dirname(__file__))
# Create the connexion application instance
connex_app = connexion.App(__name__, specification_dir=os.path.join(basedir, "templates"))
# Get the underlying Flask app instance
app = connex_app.app
# Configure the SqlAlchemy part of the app instance
app.config["SQLALCHEMY_ECHO"] = True
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL', "sqlite:///" + os.path.join(basedir, "orders.db"))
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config['JWT_SECRET_KEY'] = 'mdhs.me'
# JWT instance
jwt = JWTManager(app)
# Create the SqlAlchemy db instance
db = SQLAlchemy(app)
# Initialize Marshmallow
ma = Marshmallow(app)