annotate odfcast/__init__.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 4a34f72f036b
children 4b78fe544b09
rev   line source
37
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
1 # -*- coding: utf-8 -*-
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
2
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
3 import logging
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
4
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
5 from flask import Flask
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
6
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
7 app = Flask(__name__)
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
8 app.config.from_object('odfcast.settings')
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
9 app.config.from_envvar('ODFCAST_SETTINGS', silent=True)
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
10
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
11 if app.config["DEBUG"]:
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
12 logging.basicConfig(level=logging.DEBUG)
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
13
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
14 from odfcast.convert import ConvertView, MergeView, TemplateView
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
15
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
16
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
17 app.add_url_rule("/convert/",
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
18 view_func=ConvertView.as_view(
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
19 "convert",
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
20 app.config["PY3O_UNO_DRIVER"],
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
21 app.config["PY3O_UNO_SERVER_HOSTNAME"],
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
22 app.config["PY3O_UNO_SERVER_PORT"],
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
23 ))
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
24 app.add_url_rule("/merge/",
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
25 view_func=MergeView.as_view("merge"),
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
26 )
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
27 app.add_url_rule("/",
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
28 view_func=TemplateView.as_view("index", "index.html"),
5c3aba401382 Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents: 0
diff changeset
29 )
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)