summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-02-03 15:18:20 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-02-03 15:18:20 +0000
commit567e4e441131434c855f9232553ae939962def99 (patch)
tree4fe89521a1ef89af09ee7dea7c98c68ec6af5fb3 /django
parentbd41a51942c191d8a58536518f2e1d08456976af (diff)
Fixed #1323 -- Added ENABLE_PSYCO. Thanks, Wojtek.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/conf/global_settings.py4
-rw-r--r--django/core/handlers/modpython.py4
-rw-r--r--django/core/handlers/wsgi.py4
3 files changed, 12 insertions, 0 deletions
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 92e202edca..048504a5c8 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -187,6 +187,10 @@ DATETIME_FORMAT = 'N j, Y, P'
# http://www.djangoproject.com/documentation/templates/#now
TIME_FORMAT = 'P'
+# Whether to enable Psyco, which optimizes Python code. Requires Psyco.
+# http://psyco.sourceforge.net/
+ENABLE_PSYCO = False
+
##############
# MIDDLEWARE #
##############
diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py
index e52879065f..eec35ff072 100644
--- a/django/core/handlers/modpython.py
+++ b/django/core/handlers/modpython.py
@@ -130,6 +130,10 @@ class ModPythonHandler(BaseHandler):
from django.conf import settings
from django.core import db
+ if settings.ENABLE_PSYCO:
+ import psyco
+ psyco.profile()
+
# if we need to set up middleware, now that settings works we can do it now.
if self._request_middleware is None:
self.load_middleware()
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py
index 4d5931e630..23204e63a6 100644
--- a/django/core/handlers/wsgi.py
+++ b/django/core/handlers/wsgi.py
@@ -145,6 +145,10 @@ class WSGIHandler(BaseHandler):
from django.conf import settings
from django.core import db
+ if settings.ENABLE_PSYCO:
+ import psyco
+ psyco.profile()
+
# Set up middleware if needed. We couldn't do this earlier, because
# settings weren't available.
if self._request_middleware is None: