http://djangotricks.blogspot.tw/2015/01/performance-bottlenecks-in-django-views.html
To setup line profiling, install line_profiler and django-devserver to you virtual environment:
(myproject_env)$ pip install line_profiler (myproject_env)$ pip install django-devserver
Then make sure that you have the following settings in your settings.py or local_settings.py:
# settings.py INSTALLED_APPS = ( # ... 'devserver', ) MIDDLEWARE_CLASSES = ( # ... 'devserver.middleware.DevServerMiddleware', ) DEVSERVER_MODULES = ( 'devserver.modules.sql.SQLRealTimeModule', 'devserver.modules.sql.SQLSummaryModule', 'devserver.modules.profile.ProfileSummaryModule', # Modules not enabled by default 'devserver.modules.profile.LineProfilerModule', ) DEVSERVER_AUTO_PROFILE = True # profiles all views without the need of function decorator
I try these tools and get a bunch of analysis report from them, and I think they are useful and convenient. The following picture is one part of my result:
No comments:
Post a Comment