Beispiel #1
1
def create_app():
    app = Flask(__name__)
    app.config["SQLITE"] = "todos.db"
    app.config["API_BOOTSTRAP"] = "/static/bootstrap.min.css"
    app.config["API_BOOTSTRAP"] = "/static/bootstrap.min.css"
    app.config["ADMIN_EMAIL"] = "admin@todos.com"
    app.config["ADMIN_PASSWORD"] = "123456"

    bp_api = Blueprint("api", __name__, static_folder="static")
    api.init_app(bp_api, fn_user_role=fn_user_role, docs=__doc__)
    api.config(app.config)

    api.add_resource(Todos)
    api.add_resource(User)
    api.add_permission_resource()

    api.before_request(connect_db)
    api.after_request(close_db)

    def make_view(filename):
        return lambda *args, **kwargs: app.send_static_file(filename)

    for url, filename in url_views:
        end = os.path.splitext(filename)[0]
        app.route(url, endpoint=end)(make_view(filename))

    app.before_first_request(before_first_request)
    app.register_blueprint(bp_api, url_prefix="/api")
    return app
Beispiel #2
1
def create_app(config_name):
    app = Flask(__name__)
    app.config.from_object(config[config_name])
    config[config_name].init_app(app)

    bootstrap.init_app(app)
    api.init_app(app)

    app.route("/")
    api.add_resource(
        AutocompleteAPI.AutoCompleteLocation, "/film/locations/autocomplete", endpoint="filmlocations_auto_complete"
    )
    api.add_resource(
        FilmsAtLocationsAPI.FilmsAtLocations, "/film/locations/<string:location>", endpoint="film_locations"
    )
    api.add_resource(
        FindNearestFilmsAtLocationAPI.FindNearest7FilmsAtLocation,
        "/film/7nearme/lat/<float:lat>/<string:lat_sign>/lng/<float:lng>/<string:lng_sign>",
        endpoint="films_near_me",
    )

    from .main import main as main_blueprint

    app.register_blueprint(main_blueprint)

    return app
Beispiel #3
1
def get_flask_app(project_dir):
    static_folder = os.path.join(project_dir, "build", "assets")
    app = Flask(__name__, static_folder=static_folder, static_url_path="/static")
    app.populus_project_dir = project_dir

    app.route("/")(index_view)
    return app
Beispiel #4
1
def create_app(config, oidc_overrides=None):
    app = Flask(__name__)
    app.config.update(config)
    if oidc_overrides is None:
        oidc_overrides = {}
    oidc = OpenIDConnect(app, **oidc_overrides)
    app.route("/")(oidc.check(index))
    return app
Beispiel #5
1
def main():
    app = Flask(__name__)
    logfile, rootFolder = sys.argv[1:3]
    server = Server(logfile, rootFolder)
    app.route("/")(server.index)
    app.route("/loop")(server.loop)
    app.route("/expansion")(server.expansion)
    app.route("/directory")(server.getDirectory)
    app.route("/getFile")(server.getFile)
    app.run("0.0.0.0", 5001, debug=True)
Beispiel #6
1
class S3Proxy(object):
    def __init__(self, bucket_name, path, key, secret, host, port):
        self.bucket_name = bucket_name
        self.path = path
        self.key = key
        self.secret = secret
        self.host = host
        self.port = port

        logging.basicConfig(format="%(asctime)s: %(name)s/%(levelname)-9s: %(message)s", level=logging.INFO)

        self.s3 = boto.s3.connection.S3Connection(self.key, self.secret)
        self.bucket = self.s3.get_bucket(self.bucket_name)

        self.app = Flask(self.__class__.__name__)
        # self.app.debug = True

        self.status = self.app.route("/__status")(self.status)
        self.handle = self.app.route("/<path:path>")(self.handle)

    def run(self):
        return self.app.run(host=self.host, port=self.port)

    def status(self):
        return Response('{"status": "ok"}', mimetype="application/json")

    def handle(self, path):
        self.app.logger.debug("Request for path %r", path)
        self.app.logger.debug("s3://%s/%s%s", self.bucket_name, self.path, path)
        try:
            full_path = self.path + path
            self.app.logger.debug("full_path %r", full_path)
            if path.endswith("/"):
                return self.handle_directory(path)

            key = self.bucket.get_key(full_path)
            if key is None:
                # If we can't find a file, try it as a directory
                ### Note: Some versions of pip will make some requests for what
                ### should be directories without the trailing slash.
                keys = self.bucket.list(full_path + "/", "/")
                try:
                    iter(keys).next()
                    # there are keys to list, so send back a redirect so the client
                    # knows it should be treating this as a directory.
                    self.app.logger.warning("path does not end in / but is a directory, redirecting %r", path)
                    return redirect(path + "/")
                except StopIteration:
                    self.app.logger.warning("Key not found for path and not a directory %r", path)
                    return ("", 404)

            self.app.logger.info("Found key for path %r", path)
            return Response(key, mimetype="application/octet-stream")
        except Exception, e:
            return (str(e), 404)
Beispiel #7
0
def test_meta_view():
    app = Flask(__name__)
    api = Api(app)
    app.route("/")(api.meta_view)
    with app.test_client() as c:
        resp = c.get("/")
        assert resp.status_code == 200
        assert resp.mimetype == "text/html"
        resp = c.get("/?json")
        assert resp.status_code == 200
        assert resp.mimetype == "application/json"
Beispiel #8
0
    def test_flask(self):
        from flask import Flask, g  # nolint
        from dealer.contrib.flask import Dealer

        app = Flask("test")
        Dealer(app)
        self.assertTrue(app.revision)
        app.route("/")(lambda: g.revision)
        with app.test_request_context():
            client = app.test_client()
            response = client.get("/")
            self.assertTrue(app.revision in response.data)
Beispiel #9
0
def create_app(db_uri, datadir=DEFAULT_DATA_DIR, echo=True, pull_password=None, host=None, port=5000):
    datadir = os.path.abspath(datadir)

    app = Flask(__name__)
    app.config.setdefault("SQLALCHEMY_DATABASE_URI", db_uri)
    app.config.setdefault("SQLALCHEMY_ECHO", echo)
    app.config.setdefault("PYVO_DATADIR", datadir)
    app.config.setdefault("PYVO_PULL_PASSWORD", pull_password)
    if host:
        server_name = host
        if port != 80:
            server_name += ":{}".format(port)
        app.config["SERVER_NAME"] = server_name
    app.jinja_env.undefined = StrictUndefined
    db.init_app(app)

    for filter_name in filters.__all__:
        app.jinja_env.filters[filter_name] = getattr(filters, filter_name)

    @app.template_global()
    def url_for_lang(lang_code):
        args = dict(request.view_args)
        args["lang_code"] = lang_code
        return url_for(request.endpoint, **args)

    @app.template_global()
    def tr(cs, en):
        if g.lang_code == "cs":
            return cs
        elif g.lang_code == "en":
            return en
        raise ValueError(g.lang_code)

    @app.before_first_request
    def setup():
        db_setup(datadir)

    @app.url_value_preprocessor
    def pull_lang_code(endpoint, values):
        if values:
            g.lang_code = values.pop("lang_code", None)

    @app.url_defaults
    def add_language_code(endpoint, values):
        if "lang_code" in values or not g.lang_code:
            return
        if app.url_map.is_endpoint_expecting(endpoint, "lang_code"):
            values["lang_code"] = g.lang_code

    for url, func, options in routes:
        app.route(url, **options)(func)

    return app
    def app():
        """App, that registers if request teardown was happened."""
        app = Flask(__name__)
        app.route("/spam")(lambda: "eggs")

        app.teardown_happened = False

        @app.teardown_request
        def teardown(*_, **__):
            app.teardown_happened = True

        return app
Beispiel #11
0
def create_app(config):
    app = Flask(__name__)
    app.config.from_pyfile(config)
    app.debug = app.config.get("DEBUG", False)

    # Setup semi-permanent cache stored in os temp directory
    try:
        app.cache_file = os.path.join(tempfile.gettempdir(), "spectrometer-cache.p")
        app.cache = pickle.load(open(app.cache_file, "rb"))
    except IOError:
        app.cache = {}

    # Flask profiler is only active when in debug mode
    profiler = Profiler()
    profiler.init_app(app)

    if not app.debug:
        # Setup Logger
        logdir = app.config.get("LOG_DIR", "/var/log/spectrometer")
        logfile = os.path.join(logdir, "spectrometer.log")

        logging.getLogger().setLevel(logging.NOTSET)
        formatter = logging.Formatter("%(asctime)s (%(levelname)8s) %(name)-40s: %(message)s")
        console_handler = logging.StreamHandler()
        console_handler.setFormatter(formatter)
        logging.getLogger().addHandler(console_handler)

        try:
            file_handler = RotatingFileHandler(logfile, maxBytes=20000000, backupCount=20)
            file_handler.setFormatter(formatter)
            logging.getLogger().addHandler(file_handler)
            log.info("File logger activated.")
        except IOError:
            log.warn(
                "Unable to activate File logger. Please ensure that the "
                "log directory ({0}) is writable by the spectrometer user.".format(logdir)
            )

    # Prep resource handlers
    app.gerrithandler = GerritHandler(app.config["GERRIT_URL"])
    app.githandlers = {}

    # Stop Flask debug mode from running the scheduler twice
    if not app.debug or os.environ.get("WERKZEUG_RUN_MAIN") == "true":
        run_scheduler(app)

    app.route("/")(views.status)

    app.register_blueprint(gitapi, url_prefix="/git")
    app.register_blueprint(gerritapi, url_prefix="/gerrit")

    return app
Beispiel #12
0
def test_flask():
    from flask import Flask, g
    from dealer.contrib.flask import Dealer

    app = Flask("test")
    Dealer(app)
    assert app.revision

    app.route("/")(lambda: "%s - %s" % (g.revision, g.tag))
    with app.test_request_context():
        client = app.test_client()
        response = client.get("/")
        assert app.revision in response.data.decode("utf-8")
        assert app.tag in response.data.decode("utf-8")
Beispiel #13
0
class HydroWebServer:
    def __init__(self, crop_id):
        print("Initializing web server")
        self.svr = Flask(__name__)
        self.crop_id = crop_id
        # If HYDRO_SETTINGS environment value points to a config file
        # override the default configuration
        self.svr.config.from_envvar("HYDRO_SETTINGS", silent=True)
        Bootstrap(self.svr)
        self.svr.route("/", methods=["GET"])(web.views.index.index)

    def start(self, debug=False):
        print("Starting web server")
        self.svr.run(host=HOST, port=PORT, debug=debug)
Beispiel #14
0
def create_app():
    app = Flask(__name__)
    app.corpus = Corpus(SRC)
    app.route("/")(index)
    app.route("/<name>")(article)
    app.route("/opensearch")(open_search)
    app.route("/search")(search_view)
    return app
Beispiel #15
0
def create_backend_app(service):
    from werkzeug.routing import Map

    # Create the backend_app
    backend_app = Flask(__name__)
    backend_app.debug = True

    # Reset view functions to reset the app
    backend_app.view_functions = {}
    backend_app.url_map = Map()
    backend_app.url_map.converters["regex"] = RegexConverter

    backend = BACKENDS[service]
    for url_path, handler in backend.flask_paths.iteritems():
        backend_app.route(url_path, methods=HTTP_METHODS)(convert_flask_to_httpretty_response(handler))

    return backend_app
Beispiel #16
0
class AppConfigTest(object):
    def setUp(self):
        self.app = Flask(import_name=__name__)

    def tearDown(self):
        self.app = None

    def add_route(self, path):

        # Flask checks the name of the function to ensure that iew mappings
        # do not collide. We work around it by generating a new function name
        # for the path
        def function_to_rename():
            return "STUBBED: %s" % path

        function_to_rename.__name__ = "func_%s" % path

        self.app.route(path)(function_to_rename)
Beispiel #17
0
class Perfume(object):
    def __init__(self, debug=False):
        ""
        self.app = Flask(__name__)
        self.app.debug = debug
        self._load()

    def _load(self):
        "Updates the app's routes with all methods."
        for name in dir(self):
            method = self.__getattribute__(name)
            try:
                route = method.perfume_route
                args = method.perfume_args
            except AttributeError:
                continue

            self.app.route(route, **args)(method)

    def run(self, *args, **kwds):
        self.app.run(*args, **kwds)
Beispiel #18
0
class Logicoma(object):
    def __init__(self, config_path="configs/logicoma.json", other_opts={}):
        self.app = Flask("Logicoma")
        self.app.route("/", methods=["post"])(self.hook)
        self.other_opts = other_opts
        self.load_config(config_path)

    def load_config(self, config_path):
        with open(config_path) as fp:
            conf = json.load(fp)
        conf.update(self.other_opts)
        self.token = conf["token"]
        self.debug = conf.get("debug", False)
        self.handlers = [handlers.load_from_config(s) for s in conf["handlers"]]

    def run(self, *args, **kwargs):
        return self.app.run(*args, **kwargs)

    def dispatch(self, text):
        for h in self.handlers:
            response = h.handle(text)
            if response is not None:
                response_json = json.dumps(response)
                return (response_json, 200, {"Content-Type": "application/json"})
        return ("", 200, {})

    def hook(self):
        try:
            payload = request.form
            logger.debug("payload: %s", payload)
            if self.debug or payload and payload.get("token") == self.token:
                if "text" in payload and payload.get("user_id") != "USLACKBOT":
                    return make_response(self.dispatch(payload.get("text")))
                else:
                    return Response(status=200)
            else:
                return Response(status=400)
        except:
            logger.exception("got exception on handler")
            return Response(status=500)
Beispiel #19
0
def test_metafile(tmpdir):
    metafile = tmpdir.join("meta.json")
    json.dump({"$xxx": "test", "$roles": {}}, metafile.open("w"))
    app = Flask(__name__)
    api = Api(app, metafile=metafile.strpath)

    class Hello:
        """docstring for Hello"""

        def get(self):
            """Get hello"""

    api.add_resource(Hello)
    app.route("/")(api.meta_view)

    with app.test_client() as c:
        resp = c.get("/", headers={"Accept": "application/json"})
        assert resp.status_code == 200
        assert resp_json(resp)["$xxx"] == "test"
        assert resp_json(resp)["$roles"] == {}
        assert resp_json(resp)["hello"]["$desc"] == "docstring for Hello"
        assert resp_json(resp)["hello"]["get"]["$desc"] == "Get hello"
Beispiel #20
0
    def get_app(cls):
        """
        Contruct a Flask object from the bound methods.
        """
        app = Flask(__name__)
        for func, data, kwdata in cls.bound:

            @functools.wraps(func)
            def wrapper(*args, **kwargs):
                if u"serverid" in kwargs:
                    serverid = int(kwargs[u"serverid"])
                    for server in Server.get_instances():
                        if server.id == serverid:
                            del kwargs[u"serverid"]
                            return json.dumps(func(server, *args, **kwargs))
                    return abort(404)
                return json.dumps(func(*args, **kwargs))

            wrapper.__name__ = unicode(id(wrapper))
            print(data[0])
            app.route(*data, **kwdata)(wrapper)
        return app
def create_app():
    app = Flask(__name__)
    app.config["ADMIN_EMAIL"] = "admin@todos.com"
    app.config["ADMIN_PASSWORD"] = "123456"

    db_path = os.path.join(app.root_path, "todos.db")
    app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + db_path
    app.config["SQLALCHEMY_ECHO"] = True
    db.init_app(app)

    bp_api = Blueprint("api", __name__, static_folder="static")
    api.init_app(app, blueprint=bp_api, docs=__doc__)
    auth.init_api(api, fn_user_role=fn_user_role)

    api.add_resource(Todos)
    api.add_resource(User)
    api.add_resource(Permission, auth=auth)
    api.add_resource(ApiInfo, api=api)

    def make_view(filename):
        return lambda *args, **kwargs: app.send_static_file(filename)

    for url, filename in url_views:
        end = os.path.splitext(filename)[0]
        app.route(url, endpoint=end)(make_view(filename))

    app.before_first_request(before_first_request)
    app.register_blueprint(bp_api, url_prefix="/api")

    gen = Gen(api)
    gen.resjs("static/js/res.js")
    gen.resdocs("static/resdocs.html", resjs="/static/js/res.js", bootstrap="/static/css/bootstrap.min.css")
    gen.permission(
        "static/permission.html",
        resjs="/static/js/res.js",
        bootstrap="/static/css/bootstrap.min.css",
        vuejs="/static/js/vue.js",
    )
    return app
Beispiel #22
0
def create_backend_app(service, cors=False):
    from werkzeug.routing import Map

    # Create the backend_app
    backend_app = Flask(__name__)

    # If we set the CORS flag, wrap the app to accept all
    if cors:

        @backend_app.after_request
        def allow_cors(response):
            response.headers["Access-Control-Allow-Origin"] = "*"
            response.headers["Access-Control-Allow-Headers"] = "X-CSRF-Token"
            response.headers["Access-Control-Max-Age"] = "3"
            response.headers["Access-Control-Allow-Methods"] = "OPTIONS, HEAD, GET, POST, PUT, DELETE"
            response.headers["X-CSRF-Token"] = "5A44B387B75E54417F6C64FF3D485141"
            print(response.headers)
            return response

    backend_app.debug = True

    # Reset view functions to reset the app
    backend_app.view_functions = {}
    backend_app.url_map = Map()
    backend_app.url_map.converters["regex"] = RegexConverter

    backend = BACKENDS[service]
    for url_path, handler in backend.flask_paths.items():
        if handler.__name__ == "dispatch":
            endpoint = "{0}.dispatch".format(handler.__self__.__name__)
        else:
            endpoint = None

        backend_app.route(url_path, endpoint=endpoint, methods=HTTP_METHODS)(
            convert_flask_to_httpretty_response(handler)
        )

    return backend_app
Beispiel #23
0
class MyApp:
    servList = {}

    def __init__(self, name):
        self.app = Flask(name)
        self.app.debug = True
        # app.run(host='0.0.0.0')

    def run(self):
        self.app.run()

    def add_service(self, serv):
        # print serv.on_recv
        # self.reg_func(serv.route, serv.on_recv)
        # for func in serv.callfunc:
        #     self.reg_func(func)
        # self.servList[serv.__name__] = serv
        # route_ = "/" + serv.route + "/<path:data>"
        # print serv.callfunc.__name__
        # self.app.route(route_)(serv.callfunc)
        for k, v in serv.funcList.iteritems():
            route_ = "/" + k + "/<path:data>"
            self.app.route(route_)(v)
Beispiel #24
0
def main():
    # Create Flask app
    app = Flask(__name__)

    # Initialize logging
    logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(name)s - %(message)s")
    logger = logging.getLogger("server")

    # load config
    try:
        app.config.from_pyfile("appserver.cfg")
        logger.info("Loaded config from file appserver.cfg")
    except:
        pass

    # read command-line options
    opts, args = getopt.getopt(sys.argv[1:], "c:")
    for opt, arg in opts:
        if opt == "-c":
            # Overwrite default settings
            app.config.from_pyfile(arg)
            logger.info("Loaded config from file " + arg)
        else:
            logger.error("Unknown command-line option: " + opt)

    # initialize workers collection
    workers = WorkerCollection(app.config["WORKERS"])

    # initialize MTMonkey service
    mtmonkey = MTMonkeyService(workers, logger)

    # register routes
    app.route(app.config["URL"], methods=["POST"])(mtmonkey.post)
    app.route(app.config["URL"])(mtmonkey.get)

    # run
    app.run(host="", port=app.config["PORT"], threaded=True)
Beispiel #25
0
                resp = make_response(json.dumps(resp), 200)
            resp.headers["Access-Control-Allow-Origin"] = "*"
            resp.headers["Access-Control-Allow-Methods"] = "GET"
            resp.headers["Content-type"] = "application/json"
            if LATENCY:
                time.sleep(LATENCY)
            return resp

        registered_func = ar(*args, **kwargs)(wrap)
        registered_func._orig = func
        return registered_func

    return decorator


app.route = corsify


@app.route("/user/login", methods=["POST"])
def login():
    assertion = request.form.get("assertion")
    audience = request.form.get("audience")
    is_native = int(request.form.get("is_native"))

    print "Attempting verification:", audience, is_native

    email = persona.verify_assertion(assertion, audience, is_native)
    if not email:
        return make_response('{"error": "bad_assertion"}', 403)

    # At this point, we know that the user is a valid user.
Beispiel #26
0
@app.route("/scrap_ads/<idusers>", methods=["POST", "GET"])
def scrap_ads(idusers):
    u = User.query.filter(User.idusers == idusers).first()
    v = VPS.query.filter(VPS.idvpss == u.idvpss).first()
    https_proxy = "https://" + "@".join([":".join([str(v.login), str(v.password)]), ":".join([str(v.ip), str(v.port)])])
    http_proxy = https_proxy.replace("https", "http")
    my_env = os.environ.copy()
    my_env["https_proxy"] = https_proxy
    my_env["http_proxy"] = http_proxy
    subprocess.call(["python", "cragapp/syncronizer.py", "userscrap", "--idusers", idusers], env=my_env)

    return "Ad scraped"


app.route("/scrap_ad/<idads>", methods=["POST", "GET"])


def scrap_ad(idads):
    a = Ad.query.filter(Ad.idads == idads).first()
    u = User.query.filter(User.idusers == a.idusers).first()
    v = VPS.query.filter(VPS.idvpss == u.idvpss).first()
    proxy = "https://" + ":".join([str(v.ip), str(v.port)])
    my_env = os.environ.copy()
    my_env["https_proxy"] = proxy

    subprocess.call(["python", "cragapp/syncronizer.py", "adscrap", "--idads", idads], env=my_env)

    return "Ad scraped"

Beispiel #27
0
from flask import Flask, render_template, request, redirect, url_for
import werkzeug.exceptions

app = Flask(__name__)

import model, forms
from auth import login_required, login_factory


app.route("/login/")(login_factory(app))


@app.route("/")
@login_required(app)
def home():
    context = {
        "oczekujace_zamowienia": model.oczekujace_zamowienia(),
        "kosztorysy_do_zatwierdzenia": model.kosztorysy_do_zatwierdzenia(),
        "zlecone_kosztorysy": model.zlecone_kosztorysy(),
        "zlecenia_do_zatwierdzenia": model.zlecenia_do_zatwierdzenia(),
    }
    return render_template("home.html", **context)


@app.route("/nowe_zamowienie/", methods=["POST", "GET"])
@login_required(app)
def new_order():
    user_list = [(user["id"], user["nazwa"]) for user in model.users()]
    form = forms.NewOrderForm.feed_with_users(request.form, user_list)
    if request.method == "POST" and form.validate():
        model.save_order(form.name.data, form.description.data, form.client_id.data)
Beispiel #28
0
 def build_wsgi_app(self):
     flask_app = Flask(__name__)
     flask_app.route("/help/<path:rpc_object_url>", methods=["GET"])(self.get_help)
     flask_app.route("/call/<path:rpc_object_url>", methods=["GET"])(self.call_view)
     flask_app.route("/call/<path:rpc_object_url>", methods=["POST"])(self.call)
     return flask_app
Beispiel #29
0
app.route("/")(index)

# @app.route('/index', methods=['POST', 'GET'])
def index2():
    query = {}
    query["groupBy"] = request.args.get("groupBy", "")
    response = make_response("web")
    response.set_cookie("test_cookie_key", "test_cookie_value")
    projects = Project.query.order_by(desc(Project.score)).all()
    pw = None
    if query["groupBy"] == "problem":
        pw = ProjectWrapperTest(projects)
        return render_template("index_groupby_problem.html", projects=pw.languages)
    else:
        pw = ProjectWrapper(projects)
        return render_template("index.html", projects=pw.languages)


app.route("/index", methods=["POST", "GET"])(index2)


# @app.route('/test')
def test():
    response = make_response("web")
    response.set_cookie("test_cookie_key", "test_cookie_value")
    projects = Project.query.order_by(desc(Project.score)).all()
    pw = ProjectWrapperTest(projects)

    return render_template("index.html", projects=pw.languages)


app.route("/test")(test)
Beispiel #30
0
        filename = secure_filename(file.filename)
        try:
            os.makedirs(os.path.join(app.config['UPLOAD_FOLDER'],name)
        except:
            pass        
        file.save(os.path.join(app.config['UPLOAD_FOLDER'],name,filename))

        ##etcd stuff if we want it
        #e.set("app/"+name+"/file",filename)
        #e.set("app/"+name+"/in_port",port
        #instances#the director will crash if this in the wrong order
        #e.set("apps/"+name,1)
        return "{'host':"+name+".130.240.233.89.xip.io'}",200
    return "No file?"

@app.route("/apps/<appname>/", methods=["GET"])
def app_state(appname):
    return ""
    #return "{instances:\""+e.get("apps/"+appname).value+"\"}"
@app.route("/apps/<appname>/", methods=["PUT"])
def edit_app(appname):
    return ""
    #nummer= request.get_json()["instances"]
    #e.set("app/"+name,nummer)
    #return "",200

@app.route("/apps/<appname>/", methods=["DELETE"])
def delete_app(appname):
    return ""              
    #e.set("app/"+name+,0)
    #return "",200