Mercurial > kraina_muminkow
annotate frontend/mfrontend/__init__.py @ 9:9a0a9fa7f91d
Dodałem prototyp listy zadań w systemie
author | Michał Rudowicz <michal.rudowicz@fl9.eu> |
---|---|
date | Mon, 28 Feb 2011 19:25:51 +0100 |
parents | e0061735c327 |
children | 69ecfe51d585 |
rev | line source |
---|---|
1 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
4 import flask | |
2 | 5 from ConfigParser import SafeConfigParser, NoSectionError |
1 | 6 from mfrontend.views.frontend import frontend |
9
9a0a9fa7f91d
Dodałem prototyp listy zadań w systemie
Michał Rudowicz <michal.rudowicz@fl9.eu>
parents:
2
diff
changeset
|
7 from mfrontend.views.jobcontrol import jobcontrol |
1 | 8 from mfrontend import db, utils |
9 | |
10 | |
11 #-- konfiguracja | |
2 | 12 config = SafeConfigParser() |
1 | 13 while True: |
14 try: | |
2 | 15 config.read('config.ini') |
1 | 16 DATABASE = config.get('Basic', 'Database') |
17 DEBUG = config.getboolean('Basic', 'Debug') | |
18 SECRET_KEY = config.get('Basic', 'Secret_Key') | |
19 break | |
2 | 20 except NoSectionError: |
1 | 21 utils.default_ini() |
22 #-- koniec konfiguracji | |
23 | |
24 app = flask.Flask(__name__) | |
25 app.register_module(frontend) | |
9
9a0a9fa7f91d
Dodałem prototyp listy zadań w systemie
Michał Rudowicz <michal.rudowicz@fl9.eu>
parents:
2
diff
changeset
|
26 app.register_module(jobcontrol, url_prefix="/jobs") |
1 | 27 app.config.from_object(__name__) |
28 app.config.from_envvar('MFRONTEND_SETTINGS', silent=True) | |
29 | |
30 @app.before_request | |
31 def before_request(): | |
32 """Funkcja wywoływana zawsze przed wykonaniem żądania""" | |
33 db.connect_db() | |
34 | |
35 @app.after_request | |
36 def after_request(response): | |
37 db.disconnect_db() | |
38 return response |