prolefeeder/config.py.example

23 lines
775 B
Text
Raw Normal View History

2018-11-12 23:21:15 +01:00
import os
import random
import string
def random_choices(population, k):
"""Emulate random.choices for Python < 3.6"""
return [random.choice(population) for _ in range(k)]
2018-11-11 14:48:21 +01:00
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or \
''.join(random_choices(string.ascii_letters, k=20))
2018-11-12 19:38:02 +01:00
DATA_DIR = os.environ.get('DATA_DIR') or '/var/tmp/prolefeeder-test-data'
2019-03-06 20:19:10 +01:00
OUT_DIR = os.environ.get('OUT_DIR') or '/var/tmp/prolefeeder-test-out'
2018-11-11 14:48:21 +01:00
MAX_LENGTH = os.environ.get('MAX_LENGTH') or 180
2018-11-11 19:55:57 +01:00
KBITS = os.environ.get('KBITS') or 128
2018-11-30 18:25:56 +01:00
DEBUG = False
2019-03-06 20:19:10 +01:00
if not os.path.exists(DATA_DIR):
raise RuntimeError("DATA_DIR does not exist")
2019-03-06 20:19:10 +01:00
if not os.path.exists(OUT_DIR):
raise RuntimeError("OUT_DIR does not exist")