#!/usr/bin/env python import os import argparse from flask import Flask, render_template, send_from_directory, request, \ url_for, abort, flash, session, g, redirect app = Flask(__name__) app.config.from_object(__name__) @app.route('/', methods=['GET']) def homepage(): return render_template('home.html') @app.route('/favicon.ico', methods=['GET']) def favicon(): """ Simple static redirect """ return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico', mimetype='image/vnd.microsoft.icon') @app.route('/robots.txt', methods=['GET']) def robots(): """ "Just in case?" """ return send_from_directory(os.path.join(app.root_path, 'static'), 'robots.txt', mimetype='text/plain') ############################################################################# def main(): """Primary entry-point for torouterui. """ parser = argparse.ArgumentParser() parser.add_argument('--debug', action='store_true', help="enable debugging interface") parser.add_argument('--host', default="127.0.0.1", help="listen on this host/IP") parser.add_argument('--port', type=int, default=5050, help="listen on this port") args = parser.parse_args() app.run(debug=args.debug, host=args.host, port=args.port) if __name__ == '__main__': main()