def pre_request_logging():
    if 'text/html' in request.headers['Accept']:
        app.logger.info('\t'.join([datetime.datetime.today().ctime(),
            request.remote_addr, request.method, request.url, request.data,
            ', '.join([': '.join(x) for x in request.headers])]))
Упрощение регистрации в Flask