from flask import Flask
from config import config
from flask.ext.cors import CORS
import itsdangerous

flask_app = Flask(__name__)
flask_app.debug = config.debug()
flask_app.config.update(
    SQLALCHEMY_DATABASE_URI=config.database_connection_string(),
    CORS_HEADERS="Content-Type",
    CORS_RESOURCES={r"/api/*": {"origins": config.allowed_origins()}},
)

CORS(flask_app, supports_credentials=True)

flask_app.secret_key = config.secret_key()
flask_app.signer = itsdangerous.URLSafeTimedSerializer(flask_app.secret_key)
Example #2
0
import os
from flask import Flask
from itsdangerous import TimestampSigner

app = Flask(__name__)


def get_env():
    local_settings_found = os.path.exists(os.path.join(os.path.dirname(__file__), "config", "local.py"))
    return os.environ.get("SPARK_APPLICATION_SETTINGS", "local" if local_settings_found else "base")


def get_conf():
    return "spark.config.%s.Configuration" % get_env()


app.config.from_object(get_conf())
app.signer = TimestampSigner(app.config["SIGNER_KEY"])

from . import views
from . import api