add profiling option to server configuration

This commit is contained in:
Martin Zimmermann 2013-11-03 12:32:38 +01:00
parent 3c193bef27
commit 0473afe2db
3 changed files with 13 additions and 3 deletions

View File

@ -91,7 +91,7 @@ purge-after
Server Server
------ ------
HTTP server configuration, does **not** apply to uWSGI. HTTP server configuration, does **not** apply to uWSGI (except for `profile`).
.. code-block:: ini .. code-block:: ini
@ -99,6 +99,7 @@ HTTP server configuration, does **not** apply to uWSGI.
host = localhost host = localhost
port = 8080 port = 8080
reload = off reload = off
profile = off
host host
listen on specified interface listen on specified interface
@ -110,6 +111,10 @@ reload
reload application, when the source code has changed. Useful for reload application, when the source code has changed. Useful for
development (don't forget to use a fixed `session-key`). development (don't forget to use a fixed `session-key`).
profile
show 10 most time consuming function in Isso after each request. Do
not use in production.
SMTP SMTP
---- ----

View File

@ -162,7 +162,11 @@ def make_app(conf=None):
else: else:
logger.warn("unable to connect to HTTP server") logger.warn("unable to connect to HTTP server")
app = ProxyFix(wsgi.SubURI(SharedDataMiddleware(isso.wsgi_app, { if isso.conf.getboolean("server", "profile"):
from werkzeug.contrib.profiler import ProfilerMiddleware
isso = ProfilerMiddleware(isso, sort_by=("cumtime", ), restrictions=("isso/(?!lib)", ))
app = ProxyFix(wsgi.SubURI(SharedDataMiddleware(isso, {
'/js': join(dirname(__file__), 'js/'), '/js': join(dirname(__file__), 'js/'),
'/css': join(dirname(__file__), 'css/') '/css': join(dirname(__file__), 'css/')
}))) })))

View File

@ -92,7 +92,8 @@ class Config:
"enabled = false", "enabled = false",
"purge-after = 30d", "purge-after = 30d",
"[server]", "[server]",
"host = localhost", "port = 8080", "reload = off", "host = localhost", "port = 8080",
"reload = off", "profile = off",
"[smtp]", "[smtp]",
"username = ", "password = ", "username = ", "password = ",
"host = localhost", "port = 465", "ssl = on", "host = localhost", "port = 465", "ssl = on",