__author__ = "gnaughton"

import os

from flask import Flask

from core import config


app = Flask("leaderboards")
app.config["APP_PATH"] = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))

app.config.from_object(config)

# 2 megabytes
app.config["MAX_CONTENT_LENGTH"] = 2 * 1024 * 1024

# from util.form.form import render_control

# this is how you could make a function globally available in views
# app.jinja_env.globals.update(render_control=render_control)

# this is how you could add a filter to be globally available in views
# app.jinja_env.filters['formatElapsedTime'] = formatElapsedTime
# login manager
import core.login
import core.csrf

# to add new routes just import them here
import core.routes.main
import core.routes.api
Example #2
0
import os
import sys
from flask import Flask
from flask import render_template
from flask import request

app = Flask(__name__)
app.config["APP_PATH"] = "/var/www/deepdream/deepdream"
app.config["PENDING"] = app.config["APP_PATH"] + "/static/pending"
app.config["FINAL"] = app.config["APP_PATH"] + "/static/final"


@app.route("/")
def init():
    return render_template("index.html")


@app.route("/upload", methods=["POST"])
def imgupload():
    file = request.files["file"]

    # cleran filename: remove . and /
    save_path = os.path.join(app.config["PENDING"], file.filename)
    file.save(save_path)

    newfilename = file.filename.split(".")[0] + ".jpeg"
    return os.path.join(app.config["FINAL"], newfilename)


@app.route("/deepdreamed", methods=["POST"])
def converted():