#2407: [patch] CGI Support for django
-------------------------------------------------------+--------------------
Reporter: Martin Glueck <[EMAIL PROTECTED]> | Owner:
adrian
Status: new | Component:
Core framework
Version: SVN | Resolution:
Keywords: cgi | Stage:
Design decision needed
Has_patch: 1 | Needs_docs:
0
Needs_tests: 1 | Needs_better_patch:
1
-------------------------------------------------------+--------------------
Comment (by Thomas Güttler):
print in python code should go stderr (logfile):
===> diff -u cgi.py ~modarch/django/trunk/django/core/servers/cgi.py
--- cgi.py 2007-05-07 16:49:30.313178117 +0200
+++ /home/modarch/django/trunk/django/core/servers/cgi.py 2007-05-07
17:11:09.788411072 +0200
@@ -10,6 +10,7 @@
def runcgi():
environ = dict(os.environ.items())
+ environ['PATH_INFO'] = environ.get('PATH_INFO',"/")
environ['wsgi.input'] = sys.stdin
environ['wsgi.errors'] = sys.stderr
environ['wsgi.version'] = (1,0)
@@ -26,6 +27,9 @@
headers_set = []
headers_sent = []
+
+ stdout=sys.stdout
+ sys.stdout=sys.stderr # print should go to stderr (logfile)
def write(data):
if not headers_set:
@@ -34,13 +38,13 @@
elif not headers_sent:
# Before the first output, send the stored headers
status, response_headers = headers_sent[:] = headers_set
- sys.stdout.write('Status: %s\r\n' % status)
+ stdout.write('Status: %s\r\n' % status)
for header in response_headers:
- sys.stdout.write('%s: %s\r\n' % header)
- sys.stdout.write('\r\n')
+ stdout.write('%s: %s\r\n' % header)
+ stdout.write('\r\n')
- sys.stdout.write(data)
- sys.stdout.flush()
+ stdout.write(data)
+ stdout.flush()
def start_response(status,response_headers,exc_info=None):
if exc_info:
--
Ticket URL: <http://code.djangoproject.com/ticket/2407#comment:18>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---