diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2014-06-09 14:04:38 +0200 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2014-06-09 15:15:25 +0200 |
commit | 16ec162838eb8ab891f5b04351bb202d84a2b834 (patch) | |
tree | 975f0b567f48604f976adf35ba62f8a536a5ab16 /bootstrap.py | |
parent | supporting feed without date or with ill formated date (diff) | |
download | newspipe-16ec162838eb8ab891f5b04351bb202d84a2b834.tar.gz newspipe-16ec162838eb8ab891f5b04351bb202d84a2b834.tar.bz2 newspipe-16ec162838eb8ab891f5b04351bb202d84a2b834.zip |
making pyagregator runnable by apache
* adding bootstrap module for basic import
* redoing logging (config, proper use of the logging module)
* making secret part of config (random wouldn't work with apache since
it uses different instances of python)
* making server entry point not executing application if just imported
* not writing file for opml when we can read it from memory
Diffstat (limited to 'bootstrap.py')
-rw-r--r-- | bootstrap.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bootstrap.py b/bootstrap.py new file mode 100644 index 00000000..cadefcca --- /dev/null +++ b/bootstrap.py @@ -0,0 +1,22 @@ +# required imports and code exection for basic functionning + +import sys +if 'threading' in sys.modules: + raise Exception('threading module loaded before patching!') +import gevent.monkey +gevent.monkey.patch_thread() + +import conf +import logging + + +def set_logging(log_path, log_level=logging.INFO, + log_format='%(asctime)s %(levelname)s %(message)s'): + logger = logging.getLogger('pyaggr3g470r') + formater = logging.Formatter(log_format) + handler = logging.FileHandler(log_path) + handler.setFormatter(formater) + logger.addHandler(handler) + logger.setLevel(log_level) + +set_logging(conf.LOG_PATH) |