import os
from flask import Flask

from taskplus.apps.rest import routes
from taskplus.apps.rest.settings import ProdConfig, DevConfig, TestConfig
from taskplus.apps.rest.database import create_db
from taskplus.apps.rest.auth import login_manager, user_loader, request_loader,\
                                    unauthorized_handler


if os.environ.get('TESTING'):
    config = TestConfig
elif os.environ.get('PRODUCTION'):
    config = ProdConfig
else:
    config = DevConfig


def create_app(config_object=config):
    app = Flask(__name__)
    app.config.from_object(config_object)
    app.register_blueprint(routes.blueprint)

    login_manager.init_app(app)
    # create_db()
    return app

@@ -26,16 +26,58 @@
 rt Flask
+%0Afrom flask_cors import CORS, cross_origin
 %0A%0Afrom t
@@ -700,16 +700,57 @@
 pp(app)%0A
+    CORS(app, supports_credentials=True)%0A
     # cr

Allow Cors