from flask import Flask, request, render_template

import os


app = Flask(__name__)
app.debug = True

# Secret Key setting based on debug setting
if app.debug:
    app.secret_key = "T3st_s3cret_k3y!~$@"
else:
    app.secret_key = os.urandom(30)


@app.route("/domain", methods=["GET", "POST"])
def domain():
    if request.method == "GET":
        # search domain
        pass

    elif request.method == "POST":
        # register domain
        pass


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


if __name__ == "__main__":
    app.run(host="0.0.0.0", threaded=True)

@@ -44,16 +44,83 @@
 mplate%0A%0A
+from route import Route%0A%0Afrom route.db import init_db, db_session%0A%0A
 import o
@@ -270,16 +270,30 @@
 %22%0Aelse:%0A
+    init_db()%0A
     app.
@@ -331,63 +331,322 @@
 app.
-route(%22/domain%22, methods=%5B%22GET%22, %22POST%22%5D)%0Adef domain():
+teardown_request%0Adef remove_session(exception=None):%0A    db_session.remove()%0A%0A%0A@app.route(%22/domain%22, methods=%5B%22GET%22, %22POST%22%5D)%0Adef domain():%0A    ip = request.args.get(%22ip%22)%0A    domain = request.args.get(%22domain%22)%0A%0A    if (ip and domain) is None:%0A        return %22parameter error%22, 400%0A%0A    r = Route(ip, domain)%0A    
 %0A   
@@ -706,20 +706,26 @@
         
-pass
+r.search()
 %0A%0A    el
@@ -791,12 +791,206 @@
     
-pass
+user = register.args.get(%22user%22)%0A%0A        if user is not None:%0A            r.register(user)%0A        else:%0A            return %22user not found%22, 400%0A%0A    del r%0A%0A    return %22%7B%7D - %7B%7D%22.format(ip, domain)
 %0A%0A%0A@

Add domain route and case handling