config.py 598 B

123456789101112131415161718192021222324252627
  1. import os
  2. import sys
  3. import flask
  4. import itsdangerous
  5. import playhouse.sqlite_ext
  6. db = playhouse.sqlite_ext.SqliteExtDatabase(None)
  7. per_page = 50
  8. serializer = itsdangerous.URLSafeTimedSerializer(os.getenv("SECRET_KEY", "TEMP KEY"))
  9. app_path = os.environ["APP_PATH"]
  10. app = flask.Flask(__name__)
  11. app.secret_key = os.getenv("SECRET_KEY", "ARGLBARGL")
  12. if sys.stderr.isatty():
  13. def log(msg):
  14. sys.stderr.write(str(msg))
  15. sys.stderr.write("\n")
  16. else:
  17. def log(msg):
  18. sys.stderr.write("\x1b[31m")
  19. sys.stderr.write(str(msg))
  20. sys.stderr.write("\x1b[39m\n")