2022-03-14 07:32:16 +01:00
|
|
|
from flask import Flask
|
2022-03-13 20:43:24 +01:00
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
2022-03-14 17:36:38 +01:00
|
|
|
from models import *
|
|
|
|
from blueprint_interface import interface_blueprint
|
|
|
|
from api_blueprint_keyword import keyword_blueprint
|
|
|
|
from api_blueprint_shares import shares_blueprint
|
|
|
|
from api_blueprint_user import users_blueprint
|
2022-03-14 18:13:16 +01:00
|
|
|
from api_blueprint_transactions import transaction_blueprint
|
2022-03-15 08:14:54 +01:00
|
|
|
from api_blueprint_portfolio import portfolio_blueprint
|
2022-03-13 21:00:14 +01:00
|
|
|
|
2022-03-08 15:11:39 +01:00
|
|
|
|
2022-03-13 20:43:24 +01:00
|
|
|
def create_app():
|
|
|
|
load_dotenv()
|
|
|
|
|
|
|
|
# Create Flask app load app.config
|
|
|
|
application = Flask(__name__)
|
|
|
|
application.config.from_object("config.ConfigClass")
|
|
|
|
|
|
|
|
application.app_context().push()
|
|
|
|
|
|
|
|
db.init_app(application)
|
|
|
|
|
2022-03-13 21:00:14 +01:00
|
|
|
# Create all tables
|
|
|
|
db.create_all()
|
|
|
|
|
2022-03-14 17:10:00 +01:00
|
|
|
# api blueprints
|
|
|
|
application.register_blueprint(keyword_blueprint)
|
|
|
|
application.register_blueprint(shares_blueprint)
|
2022-03-14 18:13:16 +01:00
|
|
|
application.register_blueprint(transaction_blueprint)
|
2022-03-14 23:40:36 +01:00
|
|
|
application.register_blueprint(portfolio_blueprint)
|
2022-03-14 17:10:00 +01:00
|
|
|
application.register_blueprint(users_blueprint)
|
|
|
|
|
|
|
|
# interface blueprint
|
2022-03-14 17:36:38 +01:00
|
|
|
application.register_blueprint(interface_blueprint)
|
2022-03-13 20:50:58 +01:00
|
|
|
|
2022-03-13 20:43:24 +01:00
|
|
|
return application
|
|
|
|
|
|
|
|
|
|
|
|
app = create_app()
|
|
|
|
|
|
|
|
# Start development web server
|
2022-03-08 15:11:39 +01:00
|
|
|
if __name__ == '__main__':
|
2022-03-12 20:21:26 +01:00
|
|
|
app.run()
|