comparison main.py @ 37:5c3aba401382

Move templates and static directories to odfcast With this change odfast can also be run from an installed module
author Björn Ricks <bjoern.ricks@intevation.de>
date Thu, 16 Oct 2014 12:01:34 +0200
parents 9d65de2ebe22
children dcf870775c26
comparison
equal deleted inserted replaced
36:3e83888fb8d8 37:5c3aba401382
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 import logging
3
4 from flask import Flask
5
6 app = Flask(__name__)
7 app.config.from_object('odfcast.settings')
8 app.config.from_envvar('ODFCAST_SETTINGS', silent=True)
9
10 if app.config["DEBUG"]:
11 logging.basicConfig(level=logging.DEBUG)
12
13 from odfcast.convert import ConvertView, MergeView, TemplateView
14
15
16 app.add_url_rule("/convert/",
17 view_func=ConvertView.as_view(
18 "convert",
19 app.config["PY3O_UNO_DRIVER"],
20 app.config["PY3O_UNO_SERVER_HOSTNAME"],
21 app.config["PY3O_UNO_SERVER_PORT"],
22 ))
23 app.add_url_rule("/merge/",
24 view_func=MergeView.as_view("merge"),
25 )
26 app.add_url_rule("/",
27 view_func=TemplateView.as_view("index", "index.html"),
28 )
29
30
31 if __name__ == "__main__": 2 if __name__ == "__main__":
3 from odfcast import app
32 app.run() 4 app.run()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)