@app.route('/discuss/<name:string>', methods=['POST', 'GET'])
async def wiki_discuss(request, name):
    async with aiofiles.open('data/setting.json', encoding='utf8') as f:
        setting_data = json.loads((await f.read()))
        db = (await aiosqlite.connect((setting_data['db_name'] + '.db')))
    data = ''
    discuss_get = (await db.execute('select title, id, state, date, agree from dis where doc = ?', [name]))
    discuss_get = (await discuss_get.fetchall())
    if discuss_get:
        for discuss in discuss_get:
            data += (((((((('<h2><a href="/discuss/' + name) + '/') + discuss[1]) + '">') + discuss[1]) + '. ') + discuss[0]) + '</a></h2><hr class="wiki_hr">')
    if (request.method == 'POST'):
        discuss_title = request.form.get('wiki_discuss_textbox_1', '')
        discuss_data = request.form.get('wiki_discuss_textarea_1', '')
        if ((discuss_title == '') or (discuss_data == '')):
            return response.redirect('/error/')
        discuss_number = (await db.execute('select id from dis where doc = ? order by id desc', [name]))
        discuss_number = (await discuss_number.fetchall())
        if (not discuss_number):
            discuss_id = '1'
        else:
            discuss_id = str((int(discuss_number[0][0]) + 1))
        (await db.execute("insert into dis (doc, title, id, state, date, agree) values (?, ?, ?, 'normal', ?, '0')", [name, discuss_title, discuss_id, (await date_time())]))
        (await db.execute("insert into dis_log (id, data, date, ip, block, code, doc) values (?, ?, ?, ?, '0', ?, ?)", ['1', discuss_data, (await date_time()), (await user_name(request)), discuss_id, name]))
        (await db.commit())
        return response.redirect(((('/discuss/' + name) + '/') + discuss_id))
    return jinja.render('index.html', request, wiki_set=(await wiki_set(request, name)), data=(data + '\n            <form method="post">\n                <input type="text" placeholder="토론 제목" class="wiki_textbox" name="wiki_discuss_textbox_1">\n                <hr class="wiki_hr">\n                <textarea placeholder="토론 내용" class="wiki_textarea" name="wiki_discuss_textarea_1"></textarea>\n                <hr class="wiki_hr">\n                <button type="submit" class="wiki_button" name="wiki_discuss_button_1">확인</button>\n            </form>\n        '), title=name, sub='토론', menu=[[('w/' + name), '문서']])
@app.route('/discuss/<name:string>', methods=['POST', 'GET'])
async def wiki_discuss(request, name):
    async with aiofiles.open('data/setting.json', encoding='utf8') as f:
        setting_data = json.loads((await f.read()))
        db = (await aiosqlite.connect((setting_data['db_name'] + '.db')))
    data = 
    discuss_get = (await db.execute('select title, id, state, date, agree from dis where doc = ?', [name]))
    discuss_get = (await discuss_get.fetchall())
    if discuss_get:
        for discuss in discuss_get:
            data += (((((((('<h2><a href="/discuss/' + name) + '/') + discuss[1]) + '">') + discuss[1]) + '. ') + discuss[0]) + '</a></h2><hr class="wiki_hr">')
    if (request.method == 'POST'):
        discuss_title = request.form.get('wiki_discuss_textbox_1', )
        discuss_data = request.form.get('wiki_discuss_textarea_1', )
        if ((discuss_title == ) or (discuss_data == )):
            return response.redirect('/error/')
        discuss_number = (await db.execute('select id from dis where doc = ? order by id desc', [name]))
        discuss_number = (await discuss_number.fetchall())
        if (not discuss_number):
            discuss_id = '1'
        else:
            discuss_id = str((int(discuss_number[0][0]) + 1))
        (await db.execute("insert into dis (doc, title, id, state, date, agree) values (?, ?, ?, 'normal', ?, '0')", [name, discuss_title, discuss_id, (await date_time())]))
        (await db.execute("insert into dis_log (id, data, date, ip, block, code, doc) values (?, ?, ?, ?, '0', ?, ?)", ['1', discuss_data, (await date_time()), (await user_name(request)), discuss_id, name]))
        (await db.commit())
        return response.redirect(((('/discuss/' + name) + '/') + discuss_id))
    return jinja.render('index.html', request, wiki_set=(await wiki_set(request, name)), data=(data + '\n            <form method="post">\n                <input type="text" placeholder="토론 제목" class="wiki_textbox" name="wiki_discuss_textbox_1">\n                <hr class="wiki_hr">\n                <textarea placeholder="토론 내용" class="wiki_textarea" name="wiki_discuss_textarea_1"></textarea>\n                <hr class="wiki_hr">\n                <button type="submit" class="wiki_button" name="wiki_discuss_button_1">확인</button>\n            </form>\n        '), title=name, sub='토론', menu=[[('w/' + name), '문서']])