diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2015-12-12 21:14:28 +0100 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2015-12-17 09:42:56 +0100 |
commit | b35e9773198ef2d8b37c4ca223f08147db47de0b (patch) | |
tree | ba4b1b171b3c1ab9414a96ad264c47b0f9d1246b /bootstrap.py | |
parent | Updated link to Heroku deploy button on the About page. (diff) | |
download | newspipe-b35e9773198ef2d8b37c4ca223f08147db47de0b.tar.gz newspipe-b35e9773198ef2d8b37c4ca223f08147db47de0b.tar.bz2 newspipe-b35e9773198ef2d8b37c4ca223f08147db47de0b.zip |
moving the root of source code from / to /src/
Diffstat (limited to 'bootstrap.py')
-rw-r--r-- | bootstrap.py | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/bootstrap.py b/bootstrap.py deleted file mode 100644 index d790ee2f..00000000 --- a/bootstrap.py +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env python -# -*- coding: utf-8 - - -# required imports and code exection for basic functionning - -import os -import conf -import logging -from urllib.parse import urlsplit - -def set_logging(log_path, log_level=logging.INFO, - log_format='%(asctime)s %(levelname)s %(message)s'): - logger = logging.getLogger('jarr') - formater = logging.Formatter(log_format) - handler = logging.FileHandler(log_path) - handler.setFormatter(formater) - logger.addHandler(handler) - logger.setLevel(log_level) - -from flask import Flask -from flask.ext.sqlalchemy import SQLAlchemy - -# Create Flask application -application = Flask('web') -if os.environ.get('PYAGG_TESTING', False) == 'true': - application.debug = logging.DEBUG - application.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' - application.config['TESTING'] = True -else: - application.debug = conf.LOG_LEVEL <= logging.DEBUG - application.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True - application.config['SQLALCHEMY_DATABASE_URI'] \ - = conf.SQLALCHEMY_DATABASE_URI - -scheme, domain, _, _, _ = urlsplit(conf.PLATFORM_URL) -application.config['SERVER_NAME'] = domain -application.config['PREFERRED_URL_SCHEME'] = scheme - -set_logging(conf.LOG_PATH, log_level=conf.LOG_LEVEL) - -# 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['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 |