rpi-rgb/app/__init__.py

22 lines
599 B
Python
Raw Normal View History

2023-06-05 22:33:36 +02:00
from flask import Flask
from config import config
2023-05-28 13:38:23 +02:00
2023-06-09 20:06:31 +02:00
def create_app(config_name='development'):
2023-06-05 22:33:36 +02:00
app = Flask(__name__)
from .index import index_blueprint
from .color import color_blueprint
app.register_blueprint(index_blueprint)
app.register_blueprint(color_blueprint)
app.config.from_object(config[config_name])
config[config_name].init_app(app)
2023-05-28 13:38:23 +02:00
2023-06-05 22:33:36 +02:00
@app.cli.command()
def test():
"""Run the unit tests."""
import unittest
tests = unittest.TestLoader().discover('tests')
unittest.TextTestRunner(verbosity=2).run(tests)
2023-05-28 13:38:23 +02:00
2023-06-05 22:33:36 +02:00
return app