Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

65 Zeilen
1.4KB

  1. # Define the WSGI application object
  2. import pprint
  3. from modules.core.db import get_db
  4. from .app_config import *
  5. @app.route('/')
  6. def index():
  7. return redirect('ui')
  8. # Define the database object which is imported
  9. # by modules and controllers
  10. import modules.steps
  11. import modules.config
  12. import modules.logs
  13. import modules.sensors
  14. import modules.actor
  15. import modules.notification
  16. import modules.fermenter
  17. from modules.addon.endpoints import initPlugins
  18. import modules.ui.endpoints
  19. import modules.system.endpoints
  20. import modules.buzzer
  21. import modules.stats
  22. import modules.kettle
  23. import modules.recipe_import
  24. import modules.core.db_mirgrate
  25. from .app_config import cbpi
  26. # Build the database:
  27. # This will create the database file using SQLAlchemy
  28. pp = pprint.PrettyPrinter(indent=6)
  29. def init_db():
  30. print("INIT DB")
  31. with app.app_context():
  32. db = get_db()
  33. try:
  34. with app.open_resource('../config/schema.sql', mode='r') as f:
  35. db.cursor().executescript(f.read())
  36. db.commit()
  37. except Exception as e:
  38. pass
  39. init_db()
  40. initPlugins()
  41. cbpi.run_init()
  42. cbpi.run_background_processes()
  43. app.logger.info("##########################################")
  44. app.logger.info("### STARTUP COMPLETE")
  45. app.logger.info("##########################################")