21 lines
599 B
Python
21 lines
599 B
Python
from flask import Flask
|
|
from config import config
|
|
|
|
|
|
def create_app(config_name='development'):
|
|
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)
|
|
|
|
@app.cli.command()
|
|
def test():
|
|
"""Run the unit tests."""
|
|
import unittest
|
|
tests = unittest.TestLoader().discover('tests')
|
|
unittest.TextTestRunner(verbosity=2).run(tests)
|
|
|
|
return app
|