37 lines
1005 B
Python
37 lines
1005 B
Python
import sys
|
|
import os
|
|
|
|
# Add the project root directory to sys.path
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
|
|
from flask import Flask, render_template
|
|
from web.config import Config
|
|
from web.database import close_dbs
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
app.config.from_object(Config)
|
|
|
|
app.teardown_appcontext(close_dbs)
|
|
|
|
# Register Blueprints
|
|
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)
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return render_template('home/index.html')
|
|
|
|
return app
|
|
|
|
if __name__ == '__main__':
|
|
app = create_app()
|
|
app.run(debug=True, port=5000)
|