41 lines
942 B
Python
41 lines
942 B
Python
from flask import Flask
|
|
from dotenv import load_dotenv
|
|
|
|
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
|
|
|
|
|
|
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)
|
|
|
|
# Create all tables
|
|
db.create_all()
|
|
|
|
# api blueprints
|
|
application.register_blueprint(keyword_blueprint)
|
|
application.register_blueprint(shares_blueprint)
|
|
application.register_blueprint(users_blueprint)
|
|
|
|
# interface blueprint
|
|
application.register_blueprint(interface_blueprint)
|
|
|
|
return application
|
|
|
|
|
|
app = create_app()
|
|
|
|
# Start development web server
|
|
if __name__ == '__main__':
|
|
app.run()
|