2022-03-14 06:32:16 +00:00
|
|
|
from flask import Flask
|
2022-03-13 19:43:24 +00:00
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
2022-03-14 16:36:38 +00: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 17:13:16 +00:00
|
|
|
from api_blueprint_transactions import transaction_blueprint
|
2022-03-14 22:40:36 +00:00
|
|
|
from webservice.api_blueprint_portfolio import portfolio_blueprint
|
2022-03-13 20:00:14 +00:00
|
|
|
|
2022-03-08 14:11:39 +00:00
|
|
|
|
2022-03-13 19:43:24 +00: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 20:00:14 +00:00
|
|
|
# Create all tables
|
|
|
|
db.create_all()
|
|
|
|
|
2022-03-14 16:10:00 +00:00
|
|
|
# api blueprints
|
|
|
|
application.register_blueprint(keyword_blueprint)
|
|
|
|
application.register_blueprint(shares_blueprint)
|
2022-03-14 17:13:16 +00:00
|
|
|
application.register_blueprint(transaction_blueprint)
|
2022-03-14 22:40:36 +00:00
|
|
|
application.register_blueprint(portfolio_blueprint)
|
2022-03-14 16:10:00 +00:00
|
|
|
application.register_blueprint(users_blueprint)
|
|
|
|
|
|
|
|
# interface blueprint
|
2022-03-14 16:36:38 +00:00
|
|
|
application.register_blueprint(interface_blueprint)
|
2022-03-13 19:50:58 +00:00
|
|
|
|
2022-03-13 19:43:24 +00:00
|
|
|
return application
|
|
|
|
|
|
|
|
|
|
|
|
app = create_app()
|
|
|
|
|
|
|
|
# Start development web server
|
2022-03-08 14:11:39 +00:00
|
|
|
if __name__ == '__main__':
|
2022-03-12 19:21:26 +00:00
|
|
|
app.run()
|