__init__.py 840 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. """Fabriek Activiteit en Groei Beheer"""
  2. import os
  3. import logging
  4. from sqlalchemy import create_engine
  5. from sqlalchemy.orm import sessionmaker
  6. from dotenv import load_dotenv
  7. from apscheduler.schedulers.background import BackgroundScheduler
  8. from app.models import Base, State, Region, Player
  9. load_dotenv()
  10. # database
  11. ENGINE = create_engine(os.environ["DATABASE_URI"], client_encoding='utf8')
  12. SESSION = sessionmaker(bind=ENGINE)
  13. # scheduler
  14. SCHEDULER = BackgroundScheduler(
  15. daemon=True,
  16. job_defaults={
  17. 'misfire_grace_time': 900
  18. },
  19. )
  20. SCHEDULER.start()
  21. # logging
  22. logging.basicConfig(
  23. format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
  24. level=logging.INFO
  25. )
  26. LOGGER = logging.getLogger(__name__)
  27. # api
  28. BASE_URL = os.environ["API_URL"]
  29. HEADERS = {
  30. 'Authorization': os.environ["AUTHORIZATION"]
  31. }