Mercurial > odfcast > odfcast
annotate odfcast/__init__.py @ 49:4b78fe544b09
Allow overwriting settings via odfcast/odfcast.ini file
With this ini file we can tweak the setting on different environments
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 03 Nov 2014 11:51:03 +0100 |
parents | 5c3aba401382 |
children | 02efda1f6919 |
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 |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
15 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
|
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 ) |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
28 app.add_url_rule("/", |
5c3aba401382
Move templates and static directories to odfcast
Björn Ricks <bjoern.ricks@intevation.de>
parents:
0
diff
changeset
|
29 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
|
30 ) |