-
Notifications
You must be signed in to change notification settings - Fork 1
Usage
Create main.py :
.. code-block:: python
def app(env, start_response): start_response('200 OK', [('Content-type', 'text/plain; charset=utf-8')]) return [b'Hello World']
Run this application using wsgiref:
.. code-block:: console
$ wsgicli run main.py app
Run this application in specified host(default: localhost) and port(default: 8000):
.. code-block:: console
$ wsgicli run main.py app -h 0.0.0.0 -p 8080
Run wsgi application and serve static files:
Create static/style.css:
.. code-block:: css
.container { max-width: 980px; }
And run:
.. code-block:: console
$ wsgicli run main.py app -p 8000 --static --staticroot static --staticdirs static/ $ curl http://localhost:8000/static/main.css .container { max-width: 980px; }
Thanks to rkern/line_profiler <https://github.com/rkern/line_profiler>_ and ymyzk/wsgi_lineprof <https://github.com/ymyzk/wsgi_lineprof>_ :)
Usage is like this:
.. code-block:: console
$ wsgicli run main.py app -p 8000 --lineprof Start: 127.0.0.1:8000
Time unit: 1e-06 [sec]
47 @app.route('/')
48 def index():
49 1 1002693 name = get_name()
50 1 7 return "Hello, {}!!".format(name)
41 def get_name():
42 # Get some data...
43 1 1002670 time.sleep(1)
44 1 3 return "Monty Python"
Still Not Implemented
Using vmprof and vmprof-server.
.. code-block:: console
$ wsgicli run main.py app -p 8000 --vsprof
refs: