49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
import sys
|
|
import os
|
|
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
|
|
from flask import Flask
|
|
from web.config import Config
|
|
from web.database import close_dbs, initialize_web_db
|
|
|
|
|
|
def create_app(config_object=Config):
|
|
app = Flask(__name__)
|
|
app.config.from_object(config_object)
|
|
|
|
initialize_web_db()
|
|
from web.services.roster_version_service import RosterVersionService
|
|
RosterVersionService.ensure_initial_version()
|
|
app.teardown_appcontext(close_dbs)
|
|
|
|
from web.routes import (
|
|
admin,
|
|
awards,
|
|
main,
|
|
matches,
|
|
opponents,
|
|
players,
|
|
reports,
|
|
tactics,
|
|
teams,
|
|
wiki,
|
|
)
|
|
app.register_blueprint(main.bp)
|
|
app.register_blueprint(matches.bp)
|
|
app.register_blueprint(players.bp)
|
|
app.register_blueprint(teams.bp)
|
|
app.register_blueprint(tactics.bp)
|
|
app.register_blueprint(admin.bp)
|
|
app.register_blueprint(wiki.bp)
|
|
app.register_blueprint(opponents.bp)
|
|
app.register_blueprint(reports.bp)
|
|
app.register_blueprint(awards.bp)
|
|
|
|
return app
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app = create_app()
|
|
app.run(debug=True, port=5000)
|