6
0

__init__.py 448 B

12345678910111213141516171819
  1. import json
  2. from pathlib import Path
  3. from flask import Flask
  4. from flask_migrate import Migrate
  5. from flask_sqlalchemy import SQLAlchemy
  6. print('- Loading settings')
  7. with open('settings.json') as file:
  8. settings = json.load(file)
  9. app = Flask(__name__)
  10. app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite:///{Path.cwd() / settings['database']}"
  11. app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
  12. db = SQLAlchemy(app)
  13. migrate = Migrate(app, db)