def create_app():
    path = os.path.dirname(__file__)
    config = yaml.load(open(os.path.join(path, "config.yaml")))

    app = Flask(__name__)
    app.config["CELERY_BROKER_URL"] = config["CELERY_BROKER_URL"]
    app.config["CELERY_RESULT_BACKEND"] = config["CELERY_RESULT_BACKEND"]
    app.config["CELERY_IMPORTS"] = "worker"
    app.config["LOCATIONS"] = config["LOCATIONS"]
    app.config["DNS_TARGETS"] = config["DNS_TARGETS"]
    app.config["TESTSUITES"] = config["TESTSUITES"]
    app.config["PORT"] = config["PORT"]
    app.config["DBNAME"] = config["DBNAME"]
    app.config["DBUSER"] = config["DBUSER"]
    app.config["DBPASSWD"] = config["DBPASSWD"]
    app.config["BROKER_TRANSPORT_OPTIONS"] = {"socket_timeout": 7200}
    app.config["URL"] = config["URL"]
    app.config["CALLBACK_URL"] = config["CALLBACK_URL"]
    return app
Example #2
0
APP_PORT = 8000
APP_HOST = "0.0.0.0"
APP_URL = "localhost:8000"
SECRET_KEY = "yeah, not actually a secret"
DEFAULT_VIDEO_SIZE = "500x400"  # Tamanho default, width:height
DEFAULT_VIDEO_POSTER = "default_poster.png"
# ---------------------------------------------------------------------

try:
    from conf import *
except:
    pass

app = Flask(__name__, static_path="/upvideos_static", static_url_path="/upvideos_static")
app.config["UPLOAD_FOLDER"] = UPLOADED_FILES_DEST
app.config["URL"] = APP_URL
app.config["SECRET_KEY"] = SECRET_KEY

UPLOADED_FILES_ALLOW = ("ogg", "ogv", "webm", "mp4")
videos = UploadSet("videos", UPLOADED_FILES_ALLOW)
login_manager = LoginManager()
login_manager.login_view = "login"
login_manager.login_message = "Necessário efetuar o login."
login_manager.setup_app(app)

# ---------------------------------------------------------------------


@app.route("/secret")
@fresh_login_required
def secret():