__init__.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. # -*- coding: utf-8 -*-
  2. """
  3. (c) 2020 - Copyright ...
  4. Authors:
  5. zPlus <zplus@peers.community>
  6. Notes
  7. This module is kept empty because when the module forgefed.tasks is
  8. imported by celery (when the queue worker is started), __init__.py is
  9. also executed and we don't want to start a new Flask instance.
  10. The entry point of the application is app.py.
  11. We only set the logging options here because the "logging" module works
  12. hierarchically. When we create a new log object using
  13. logging.getLogger(__name__) the logger object is called
  14. "forgefed.modulename" and will inherit its settings from the root
  15. logger. So we set them here instead of in every single module.
  16. https://docs.python.org/3/library/logging.html#logger-objects
  17. """
  18. import logging
  19. from . import settings
  20. log = logging.getLogger(__name__)
  21. log.setLevel(settings.LOG_LEVEL)
  22. # The app URL defined in the Pagure configuration, eg. "https://example.org/"
  23. # We need this for generating absolute URIs in Activities.
  24. import pagure.config
  25. APP_URL = pagure.config.config['APP_URL'].rstrip('/')
  26. assert APP_URL and len(APP_URL) > 0, 'APP_URL missing from Pagure configuration.'