Mercurial > odfcast
annotate main.py @ 4:46f31348fe01
Implement a TemplateConvertView to allow convert odt templates with variable
substitution
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 26 Sep 2014 15:35:21 +0200 |
parents | 4a34f72f036b |
children | 7f546e8a6e7a |
rev | line source |
---|---|
0
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
3 from flask import Flask |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
4 |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 from odfcast.convert import ConvertView |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
6 |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
7 app = Flask(__name__) |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
8 app.config.from_object('odfcast.settings') |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
9 app.config.from_envvar('ODFCAST_SETTINGS', silent=True) |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 app.add_url_rule("/convert/", |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 view_func=ConvertView.as_view( |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 "convert", |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 app.config["PY3O_UNO_DRIVER"], |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 app.config["PY3O_UNO_SERVER_HOSTNAME"], |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 app.config["PY3O_UNO_SERVER_PORT"], |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 )) |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 if __name__ == "__main__": |
4a34f72f036b
Add initial conversion service
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 app.run() |