Mercurial > odfcast > odfcast
annotate odfcast/__init__.py @ 73:02efda1f6919
issue5117: service for checking a pdf for merging readiness added.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 06 Mar 2015 14:56:26 +0100 |
parents | 4b78fe544b09 |
children |
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') |
49
4b78fe544b09
Allow overwriting settings via odfcast/odfcast.ini file
Björn Ricks <bjoern.ricks@intevation.de>
parents:
37
diff
changeset
|
9 app.config.from_pyfile('odfcast.ini', silent=True) |
37
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
10 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
|
11 |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
12 if app.config["DEBUG"]: |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
13 logging.basicConfig(level=logging.DEBUG) |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
14 |
73
02efda1f6919
issue5117: service for checking a pdf for merging readiness added.
Bernhard Reiter <bernhard@intevation.de>
parents:
49
diff
changeset
|
15 from odfcast.convert import ConvertView, MergeView, CheckView, TemplateView |
37
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 |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
18 app.add_url_rule("/convert/", |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
19 view_func=ConvertView.as_view( |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
20 "convert", |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
21 app.config["PY3O_UNO_DRIVER"], |
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_HOSTNAME"], |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
23 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
|
24 )) |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
25 app.add_url_rule("/merge/", |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
26 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
|
27 ) |
73
02efda1f6919
issue5117: service for checking a pdf for merging readiness added.
Bernhard Reiter <bernhard@intevation.de>
parents:
49
diff
changeset
|
28 app.add_url_rule("/check/", |
02efda1f6919
issue5117: service for checking a pdf for merging readiness added.
Bernhard Reiter <bernhard@intevation.de>
parents:
49
diff
changeset
|
29 view_func=CheckView.as_view("check"), |
02efda1f6919
issue5117: service for checking a pdf for merging readiness added.
Bernhard Reiter <bernhard@intevation.de>
parents:
49
diff
changeset
|
30 ) |
37
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
31 app.add_url_rule("/", |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
32 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
|
33 ) |