示例#1
0
 def action(hostname=('h', hostname), port=('p', port),
            reloader=use_reloader, debugger=use_debugger,
            evalex=use_evalex, threaded=threaded, processes=processes):
     """Start a new development server."""
     from serving import run_simple
     app = app_factory()
     run_simple(hostname, port, app, reloader, debugger, evalex,
                extra_files, 1, threaded, processes,
                static_files=static_files, ssl_context=ssl_context)
示例#2
0
        'sys_path': '\n'.join(sys_path)
    }


def test_app(environ, start_response):
    """Simple test application that dumps the environment.  You can use
    it to check if Werkzeug is working properly:

    .. sourcecode:: pycon

        >>> from serving import run_simple
        >>> from testapp import test_app
        >>> run_simple('localhost', 3000, test_app)
         * Running on http://localhost:3000/

    The application displays important information from the WSGI environment,
    the Python interpreter and the installed libraries.
    """
    req = Request(environ, populate_request=False)
    if req.args.get('resource') == 'logo':
        response = logo
    else:
        response = Response(render_testapp(req), mimetype='text/html')
    return response(environ, start_response)


if __name__ == '__main__':
    from serving import run_simple

    run_simple('localhost', 5000, test_app, use_reloader=True)
示例#3
0
        'sys_path': '\n'.join(sys_path)
    }


def test_app(environ, start_response):
    """Simple test application that dumps the environment.  You can use
    it to check if Werkzeug is working properly:

    .. sourcecode:: pycon

        >>> from serving import run_simple
        >>> from testapp import test_app
        >>> run_simple('localhost', 3000, test_app)
         * Running on http://localhost:3000/

    The application displays important information from the WSGI environment,
    the Python interpreter and the installed libraries.
    """
    req = Request(environ, populate_request=False)
    if req.args.get('resource') == 'logo':
        response = logo
    else:
        response = Response(render_testapp(req), mimetype='text/html')
    return response(environ, start_response)


if __name__ == '__main__':
    from serving import run_simple

    run_simple('localhost', 5000, test_app, use_reloader=True)