utils.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:spichi 作者: ifkite 项目源码 文件源码
def redirect(location, status=302):
    """
    which is seldom used in api server
    """
    from werkzeug.wrappers import Response
    from werkzeug.urls import iri_to_uri
    location = iri_to_uri(location, safe_conversion=True)
    return Response(
            "<!DOCTYPE html>\
                <html>\
                    <h1>Redirecting...</h1>\
                    <a href='{0}'>touch this to make manually redirection</a>\
                </html>"
            .format(location), status=status, headers={'Location': location})


# sample
# app = create_app()
# @app.route('/', 'home')
# def home(request):
#   app.UploadHandlerClass(request).save()
#   OR give some specific filenames
#   app.UploadHandlerClass(request, ['image']).save()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号