2022-08-22 16:43:56 +02:00
|
|
|
import os # for using paths in config
|
2022-06-08 14:22:58 +02:00
|
|
|
|
|
|
|
from flask import Flask
|
|
|
|
|
|
|
|
def create_app(test_config=None):
|
|
|
|
app = Flask(__name__, instance_relative_config=True)
|
2022-08-22 16:43:56 +02:00
|
|
|
app.config.from_object('tlapbot.default_config')
|
|
|
|
app.config.from_object('tlapbot.config')
|
2022-06-08 14:22:58 +02:00
|
|
|
|
|
|
|
# ensure the instance folder exists
|
|
|
|
try:
|
|
|
|
os.makedirs(app.instance_path)
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
from . import db
|
2022-08-17 16:33:40 +02:00
|
|
|
from . import owncastWebhooks
|
|
|
|
app.register_blueprint(owncastWebhooks.bp)
|
2022-06-08 14:22:58 +02:00
|
|
|
db.init_app(app)
|
|
|
|
|
|
|
|
return app
|
|
|
|
|
2022-08-17 16:33:40 +02:00
|
|
|
|
|
|
|
|
2022-06-08 14:22:58 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
create_app()
|