#!/usr/bin/env python3 """ The primary module for serving the Aberrant application. """ import signal from flask import Flask, render_template, send_from_directory import rtorrent app = Flask(__name__) app.jinja_env.trim_blocks = True app.jinja_env.lstrip_blocks = True app.jinja_env.undefined = "StrictUndefined" rtorrent.init() signal.signal(signal.SIGINT, rtorrent.stop_watch) @app.route("/") def index(): """The index page.""" torrents = rtorrent.get_active() return render_template("index.html", **locals()) @app.route("/static/") def send_static(path): """Sends static files.""" return send_from_directory("static", path) if __name__ == "__main__": app.run(host='0.0.0.0', port=5250)