An ebook/comic library service and web client
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
829 B

  1. import os
  2. from flask import Flask
  3. from atheneum.api import api_blueprint
  4. def create_app(test_config=None):
  5. app = Flask(__name__, instance_relative_config=True)
  6. app.config.from_mapping(
  7. SECRET_KEY='dev',
  8. SQLALCHEMY_DATABASE_URI='sqlite:////tmp/test.db'
  9. # SQLALCHEMY_DATABASE_URI=os.path.join(app.instance_path, 'atheneum.db')
  10. )
  11. if test_config is None:
  12. app.config.from_object('atheneum.default_settings')
  13. app.config.from_pyfile('config.py', silent=True)
  14. if (os.getenv('ATHENEUM_SERVER_SETTINGS', None)):
  15. app.config.from_envvar('ATHENEUM_SERVER_SETTINGS')
  16. else:
  17. app.config.from_pyfile(test_config)
  18. try:
  19. os.makedirs(app.instance_path)
  20. except OSError:
  21. pass
  22. app.register_blueprint(api_blueprint)
  23. return app