| 16 | |
| 17 | Note that this should only be used on 32bit systems. See http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks . |
| 18 | |
| 19 | One possible way to determine this automatically: |
| 20 | {{{ |
| 21 | #!python |
| 22 | from platform import architecture |
| 23 | |
| 24 | if architecture()[0] != '32bit': |
| 25 | raise Exception("Don't use this on non-32-bit platforms") |
| 26 | |
| 27 | class PsycoMiddleware(object): |
| 28 | """ |
| 29 | This middleware enables the psyco extension module which can massively |
| 30 | speed up the execution of any Python code. |
| 31 | """ |
| 32 | def process_request(self, request): |
| 33 | try: |
| 34 | import psyco |
| 35 | psyco.profile() |
| 36 | except ImportError: |
| 37 | pass |
| 38 | return None |
| 39 | }}} |