default_config.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import logging
  2. import os.path
  3. import sys
  4. HOST = "localhost"
  5. PORT = "8000"
  6. # pastelog is just "paste", but customized to accept logging options
  7. WSGI_SERVER = "pastelog"
  8. # these are pastelog-specific options for logging engine
  9. TRANSLOGGER_OPTS = {
  10. "logger_name": "accesslog",
  11. "set_logger_level": logging.WARNING,
  12. "setup_console_handler": False,
  13. }
  14. WSGI_SERVER_OPTIONS = {}
  15. DEBUG = True
  16. DB_URI = "sqlite:///techrec.db"
  17. AUDIO_OUTPUT = "output/"
  18. AUDIO_INPUT = "rec/"
  19. AUDIO_INPUT_FORMAT = "%Y-%m/%d/rec-%Y-%m-%d-%H-%M-%S.mp3"
  20. AUDIO_OUTPUT_FORMAT = "techrec-%(startdt)s-%(endtime)s-%(name)s.mp3"
  21. FORGE_TIMEOUT = 20
  22. FORGE_MAX_DURATION = 3600 * 5
  23. FFMPEG_OUT_CODEC = ["-acodec", "copy"]
  24. FFMPEG_OPTIONS = ["-loglevel", "warning", "-n"]
  25. FFMPEG_PATH = "ffmpeg"
  26. # tag:value pairs
  27. TAG_EXTRA = {}
  28. # LICENSE URI is special because date need to be added
  29. TAG_LICENSE_URI = None
  30. # defaults
  31. STATIC_FILES = "static/"
  32. STATIC_PAGES = "pages/"
  33. if getattr(sys, 'frozen', False): # pyinstaller
  34. STATIC_FILES = os.path.join(sys._MEIPASS, STATIC_FILES)
  35. STATIC_PAGES = os.path.join(sys._MEIPASS, STATIC_PAGES)
  36. else:
  37. try:
  38. from pkg_resources import resource_filename, resource_isdir
  39. if resource_isdir("techrec", "pages"):
  40. STATIC_PAGES = resource_filename("techrec", "pages")
  41. STATIC_FILES = resource_filename("techrec", "static")
  42. except ImportError:
  43. logging.exception("Error loading resources from installed part")