Mercurial > kraina_muminkow
view frontend/mfrontend/__init__.py @ 2:e0061735c327
Usunąłem nieskończoną pętlę
author | michalr |
---|---|
date | Tue, 22 Feb 2011 18:37:32 +0000 |
parents | c3fb1e9fc1f7 |
children | 9a0a9fa7f91d |
line wrap: on
line source
#!/usr/bin/python # -*- coding: utf-8 -*- import flask from ConfigParser import SafeConfigParser, NoSectionError from mfrontend.views.frontend import frontend from mfrontend import db, utils #-- konfiguracja config = SafeConfigParser() while True: try: config.read('config.ini') DATABASE = config.get('Basic', 'Database') DEBUG = config.getboolean('Basic', 'Debug') SECRET_KEY = config.get('Basic', 'Secret_Key') break except NoSectionError: utils.default_ini() #-- koniec konfiguracji app = flask.Flask(__name__) app.register_module(frontend) app.config.from_object(__name__) app.config.from_envvar('MFRONTEND_SETTINGS', silent=True) @app.before_request def before_request(): """Funkcja wywoływana zawsze przed wykonaniem żądania""" db.connect_db() @app.after_request def after_request(response): db.disconnect_db() return response