bjoern@0: # -*- coding: utf-8 -*- bjoern@14: import logging bjoern@0: bjoern@0: from flask import Flask bjoern@0: bjoern@0: app = Flask(__name__) bjoern@0: app.config.from_object('odfcast.settings') bjoern@0: app.config.from_envvar('ODFCAST_SETTINGS', silent=True) bjoern@0: bjoern@14: if app.config["DEBUG"]: bjoern@14: logging.basicConfig(level=logging.DEBUG) bjoern@14: bjoern@14: from odfcast.convert import ConvertView, TemplateConvertView bjoern@14: bjoern@0: bjoern@0: app.add_url_rule("/convert/", bjoern@0: view_func=ConvertView.as_view( bjoern@0: "convert", bjoern@0: app.config["PY3O_UNO_DRIVER"], bjoern@0: app.config["PY3O_UNO_SERVER_HOSTNAME"], bjoern@0: app.config["PY3O_UNO_SERVER_PORT"], bjoern@0: )) bjoern@6: app.add_url_rule("/template/", bjoern@6: view_func=TemplateConvertView.as_view( bjoern@6: "template", bjoern@6: app.config["PY3O_UNO_DRIVER"], bjoern@6: app.config["PY3O_UNO_SERVER_HOSTNAME"], bjoern@6: app.config["PY3O_UNO_SERVER_PORT"], bjoern@6: )) bjoern@0: bjoern@0: if __name__ == "__main__": bjoern@0: app.run()