add profiling option to server configuration

legacy/0.4
Martin Zimmermann 11 years ago
parent 3c193bef27
commit 0473afe2db

@ -91,7 +91,7 @@ purge-after
Server
------
HTTP server configuration, does **not** apply to uWSGI.
HTTP server configuration, does **not** apply to uWSGI (except for `profile`).
.. code-block:: ini
@ -99,6 +99,7 @@ HTTP server configuration, does **not** apply to uWSGI.
host = localhost
port = 8080
reload = off
profile = off
host
listen on specified interface
@ -110,6 +111,10 @@ reload
reload application, when the source code has changed. Useful for
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
----

@ -162,7 +162,11 @@ def make_app(conf=None):
else:
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/'),
'/css': join(dirname(__file__), 'css/')
})))

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

Loading…
Cancel
Save