diff options
author | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-03-04 07:48:14 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-03-04 07:48:14 +0100 |
commit | 1c0ba8fad47489ce987e628605fd106f981d8075 (patch) | |
tree | b381e4c8c910b2f2f282f6dadbda1a8c1938e358 /bootstrap.py | |
parent | Typo. (diff) | |
parent | adding refresh rate to the profile form (diff) | |
download | newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.tar.gz newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.tar.bz2 newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.zip |
Merged in jaesivsm/pyaggr3g470r/evol/api (pull request #6)
Evolution Arch, API and new crawler
Diffstat (limited to 'bootstrap.py')
-rw-r--r-- | bootstrap.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/bootstrap.py b/bootstrap.py index 85bac49b..5cfd2250 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -1,5 +1,6 @@ # required imports and code exection for basic functionning +import os import conf import logging @@ -12,4 +13,28 @@ def set_logging(log_path, log_level=logging.INFO, logger.addHandler(handler) logger.setLevel(log_level) -set_logging(conf.LOG_PATH) +from flask import Flask +from flask.ext.sqlalchemy import SQLAlchemy + +# Create Flask application +application = Flask('pyaggr3g470r') +application.debug = conf.WEBSERVER_DEBUG +set_logging(conf.LOG_PATH, log_level=logging.DEBUG if conf.WEBSERVER_DEBUG + else logging.INFO) + +# Create dummy secrey key so we can use sessions +application.config['SECRET_KEY'] = getattr(conf, 'WEBSERVER_SECRET', None) +if not application.config['SECRET_KEY']: + application.config['SECRET_KEY'] = os.urandom(12) +application.config['SQLALCHEMY_DATABASE_URI'] = conf.SQLALCHEMY_DATABASE_URI + +application.config['RECAPTCHA_USE_SSL'] = True +application.config['RECAPTCHA_PUBLIC_KEY'] = conf.RECAPTCHA_PUBLIC_KEY +application.config['RECAPTCHA_PRIVATE_KEY'] = conf.RECAPTCHA_PRIVATE_KEY + +db = SQLAlchemy(application) + +def populate_g(): + from flask import g + g.db = db + g.app = application |