|
- # THIRD PARTY
- from flask import Flask
- from flask_cors import CORS
- from flask_sqlalchemy import SQLAlchemy
- from flask_jwt_extended import JWTManager, create_access_token
- from flask_marshmallow import Marshmallow
-
- # CONSTANTS IMPORT
- from .Constants import constants
-
- app = Flask(__name__, template_folder='../templates') # App initialization
-
- # DB URI
- uri = "mysql+pymysql://"+constants["mysql"]["user"]+":"+constants["mysql"]["password"]+"@"+constants["mysql"]["host"]+"/"+constants["mysql"]["db_name"]+"?&autocommit=false"
-
- # APP CONFIGURATIONS
- app.config["SQLALCHEMY_DATABASE_URI"] = uri
- app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
- app.config["JWT_SECRET_KEY"] = "use-a-secret-key"
-
- # INSTANCES
- cors = CORS(app)
- db = SQLAlchemy(app)
- jwt = JWTManager(app)
- ma = Marshmallow(app)
|