Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #5677 -- update modpython stdout documentation. Thanks to Manfr…

…ed Wassmann for the report, nickefford for the initial patch and Graham Dumpleton for the expert advice.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14059 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c93f5e5d0e530203048ddb6424ef43acabe17cf1 1 parent b7a73cf
Simon Meers authored October 09, 2010

Showing 1 changed file with 18 additions and 6 deletions. Show diff stats Hide diff stats

  1. 24  docs/howto/deployment/modpython.txt
24  docs/howto/deployment/modpython.txt
@@ -158,6 +158,8 @@ the full URL.
158 158
 When deploying Django sites on mod_python, you'll need to restart Apache each
159 159
 time you make changes to your Python code.
160 160
 
  161
+.. _mod_python documentation: http://modpython.org/live/current/doc-html/directives.html
  162
+
161 163
 Multiple Django installations on the same Apache
162 164
 ================================================
163 165
 
@@ -211,15 +213,25 @@ everything for each request. But don't do that on a production server, or we'll
211 213
 revoke your Django privileges.
212 214
 
213 215
 If you're the type of programmer who debugs using scattered ``print``
214  
-statements, note that ``print`` statements have no effect in mod_python; they
215  
-don't appear in the Apache log, as one might expect. If you have the need to
216  
-print debugging information in a mod_python setup, either do this::
  216
+statements, note that output to ``stdout`` will not appear in the Apache
  217
+log and can even `cause response errors`_.
217 218
 
218  
-    assert False, the_value_i_want_to_see
  219
+.. _cause response errors: http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html
219 220
 
220  
-Or add the debugging information to the template of your page.
  221
+If you have the need to print debugging information in a mod_python setup, you 
  222
+have a few options. You can print to ``stderr`` explicitly, like so::
  223
+ 
  224
+    print >> sys.stderr, 'debug text'
  225
+    sys.stderr.flush()
  226
+ 
  227
+(note that ``stderr`` is buffered, so calling ``flush`` is necessary if you wish
  228
+debugging information to be displayed promptly.)
  229
+ 
  230
+A more compact approach is to use an assertion::
221 231
 
222  
-.. _mod_python documentation: http://modpython.org/live/current/doc-html/directives.html
  232
+    assert False, 'debug text'
  233
+
  234
+Another alternative is to add debugging information to the template of your page.
223 235
 
224 236
 Serving media files
225 237
 ===================

0 notes on commit c93f5e5

Please sign in to comment.
Something went wrong with that request. Please try again.