Login

Snippets by roppert

Snippet List

Load customized SQL

A management.py loading customized SQL feeding it raw to the database backend. Just put it as `management.py` in your app and put whatever SQL you want run after syncdb in `app/sql/custom.backend_driver.sql`. If the `backend_driver` is skipped the SQL will be loaded no matter database backend. Since it is run after syncdb it will also be run for test.

  • sql
  • test
  • "initial
Read More

pycallgraph

Simple debug middleware that uses [pycallgraph](http://pycallgraph.slowchop.com) to get a visual representation of the call graph, including number of calls and execution times. Usage: 1. Replace *myapp* in the snippet with the name of your application and or adjust include and exclude according to your needs 2. Add CallgraphMiddleware to your middlewares in settings.py 3. Append ?prof to any URL in your application to trigger the callgraph creation Each callgraph cerated will be named callgraph-*timestamp*.png. This is because multiple callgraphs will be created when a re-direction occurs for example.

  • middleware
  • profile
  • debug
Read More

roppert has posted 2 snippets.