34 lines
881 B
Python
34 lines
881 B
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()
|
|
app.teardown_appcontext(close_dbs)
|
|
|
|
from web.routes import main, matches, players, teams, tactics, admin, wiki, opponents
|
|
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)
|
|
|
|
return app
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app = create_app()
|
|
app.run(debug=True, port=5000)
|