コード例 #1
0
ファイル: app.py プロジェクト: ididy/lunar
@app.route('/show/<int:id>')
def test_sync_args(id):
    return id


@app.route('/test_post', methods=['GET', 'POST'])
def test_post():
    if app.request.method == 'GET':
        return app.render('test_post.html')
    return app.request.forms["title"], app.request.forms["tag"]


@app.route('/test_redirect')
def test_redirect():
    return app.redirect('/')


@app.route('/redirect_with_args')
def test_redirect_with_url():
    return app.redirect(app.url_for(test_sync_args, id=1))


@app.route('/test_jsonify')
def test_jsonify():
    return app.jsonify(name='lunar')


if __name__ == '__main__':
    app.run(DEBUG=True)
コード例 #2
0
ファイル: app.py プロジェクト: break2017/lunar
@app.route('/show/<int:id>')
def test_sync_args(id):
    return id


@app.route('/test_post', methods=['GET', 'POST'])
def test_post():
    if app.request.method == 'GET':
        return app.render('test_post.html')
    return app.request.forms["title"], app.request.forms["tag"]


@app.route('/test_redirect')
def test_redirect():
    return app.redirect('/')


@app.route('/redirect_with_args')
def test_redirect_with_url():
    return app.redirect(app.url_for(test_sync_args, id=1))


@app.route('/test_jsonify')
def test_jsonify():
    return app.jsonify(name='lunar')


if __name__ == '__main__':
    app.run(DEBUG=True)