#!python3 import pygit2 from flask import Flask, render_template, jsonify, request, redirect, send_from_directory from flask_dropzone import Dropzone from argparse import ArgumentParser app = Flask(__name__) app.config['SECRET_KEY'] = 'OlbodTyshnokTyafveg' app.config['PREFERRED_URL_SCHEME'] = 'https' app.config['DROPZONE_SERVE_LOCAL'] = True app.config['DROPZONE_MAX_FILE_SIZE'] = 128 app.config['DROPZONE_UPLOAD_MULTIPLE'] = True app.config['DROPZONE_PARALLEL_UPLOADS'] = 10 app.config['DROPZONE_ALLOWED_FILE_CUSTOM'] = True app.config['DROPZONE_ALLOWED_FILE_TYPE'] = '' app.config['DROPZONE_DEFAULT_MESSAGE'] = 'Ziehe die Dateien hier hin, um sie hochzuladen oder klicken Sie zur Auswahl.' dropzone = Dropzone(app) @app.route("/admin", methods=['GET']) def admin(): repo = pygit2.Repository('.') commit = repo[repo.lookup_branch("master").target] url_root = request.url_root.replace('http://', 'https://', 1) return render_template('index.html', tree = commit.tree, url_root = url_root) if __name__ == "__main__": parser = ArgumentParser(description="CCCMS") parser.add_argument("-H", "--host", help="Hostname of the Flask app " + "[default %s]" % "127.0.0.1", default="127.0.0.1") parser.add_argument("-P", "--port", help="Port for the Flask app " + "[default %s]" % "5000", default="5000") args = parser.parse_args() app.run(host=args.host, port=int(args.port))