# gen basic auth CONFIG["BASIC_AUTH"] = "Basic %s" % base64.encodestring("%s:%s" % (CONFIG["NAME"], CONFIG["PASSWORD"]))[:-1] # session config if "REDIS_SESSION" in CONFIG: r = redis.Redis( host=CONFIG["REDIS_SESSION"]["host"], port=CONFIG["REDIS_SESSION"]["port"], password=CONFIG["REDIS_SESSION"]["pass"], ) app.permanent_session_lifetime = datetime.timedelta(days=365) app.session_interface = RedisSessionInterface(r) app.config["CACHE_TYPE"] = "redis" app.config["CACHE_REDIS_HOST"] = r app.config["CACHE_KEY_PREFIX"] = "cache:" # app.config['CACHE_REDIS_DB'] = 1 cache.init_app(app) # log config app.level = DEBUG if ENV == "develop" else INFO handler_list = [] if "REDIS_LOG" in CONFIG: handler = RedisHandler.get_instance( "web", CONFIG["REDIS_LOG"]["host"], CONFIG["REDIS_LOG"]["port"], CONFIG["REDIS_LOG"]["pass"] ) handler_list.append(handler) handler_list.append(StreamHandler()) app.logger.handlers = [] for h in handler_list: h.setLevel(app.level)
# configuration app.config["DEBUG"] = True app.config["VALID_SOLAR_SYSTEMS"] = { "-1": "Trade Hub Regions", "30000142": "Jita", "30002187": "Amarr", "30002659": "Dodixie", "30002510": "Rens", "30002053": "Hek", } app.config["TYPES"] = json.loads(open("data/types.json").read()) app.config["USER_AGENT"] = "Evepraisal/1.0 +http://evepraisal.com/" app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///../data/scans.db" app.config["CACHE_TYPE"] = "memcached" app.config["CACHE_KEY_PREFIX"] = "evepraisal" app.config["CACHE_MEMCACHED_SERVERS"] = ["127.0.0.1:11211"] app.config["CACHE_DEFAULT_TIMEOUT"] = 10 * 60 app.config["TEMPLATE"] = "sudorandom" app.config["SECRET_KEY"] = "SET ME TO SOMETHING SECRET IN THE APP CONFIG!" app.config["USER_DEFAULT_OPTIONS"] = {"autosubmit": False, "share": True} app.config.from_pyfile("../application.cfg", silent=True) locale.setlocale(locale.LC_ALL, "") oid = OpenID(app) db = SQLAlchemy(app) babel = Babel(app) cache = Cache() cache.init_app(app)