Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #20667 - Removed discussion of DEBUG from tutorial.

Forward-port of 3493f18 from master.
  • Loading branch information...
commit 31ee1207877578ad683c1d4f3aed47fc6dc7637e 1 parent 5df84b2
Tim Graham authored August 01, 2013
15  docs/howto/deployment/checklist.txt
@@ -206,6 +206,21 @@ See :doc:`/howto/error-reporting` for details on error reporting by email.
206 206
 
207 207
     .. _Sentry: http://sentry.readthedocs.org/en/latest/
208 208
 
  209
+Customize the default error views
  210
+---------------------------------
  211
+
  212
+Django includes default views and templates for several HTTP error codes. You
  213
+may want to override the default templates by creating the following templates
  214
+in your root template directory: ``404.html``, ``500.html``, ``403.html``, and
  215
+``400.html``. The default views should suffice for 99% of Web applications, but
  216
+if you desire to customize them, see these instructions which also contain
  217
+details about the default templates:
  218
+
  219
+* :ref:`http_not_found_view`
  220
+* :ref:`http_internal_server_error_view`
  221
+* :ref:`http_forbidden_view`
  222
+* :ref:`http_bad_request_view`
  223
+
209 224
 Miscellaneous
210 225
 =============
211 226
 
45  docs/intro/tutorial03.txt
@@ -454,51 +454,6 @@ just as :func:`~django.shortcuts.get_object_or_404` -- except using
454 454
 :meth:`~django.db.models.query.QuerySet.get`. It raises
455 455
 :exc:`~django.http.Http404` if the list is empty.
456 456
 
457  
-Write a 404 (page not found) view
458  
-=================================
459  
-
460  
-When you raise :exc:`~django.http.Http404` from within a view, Django
461  
-will load a special view devoted to handling 404 errors. It finds it
462  
-by looking for the variable ``handler404`` in your root URLconf (and
463  
-only in your root URLconf; setting ``handler404`` anywhere else will
464  
-have no effect), which is a string in Python dotted syntax -- the same
465  
-format the normal URLconf callbacks use. A 404 view itself has nothing
466  
-special: It's just a normal view.
467  
-
468  
-You normally won't have to bother with writing 404 views. If you don't set
469  
-``handler404``, the built-in view :func:`django.views.defaults.page_not_found`
470  
-is used by default. Optionally, you can create a ``404.html`` template
471  
-in the root of your template directory. The default 404 view will then use that
472  
-template for all 404 errors when :setting:`DEBUG` is set to ``False`` (in your
473  
-settings module). If you do create the template, add at least some dummy
474  
-content like "Page not found".
475  
-
476  
-.. warning::
477  
-
478  
-    If :setting:`DEBUG` is set to ``False``, all responses will be
479  
-    "Bad Request (400)" unless you specify the proper :setting:`ALLOWED_HOSTS`
480  
-    as well (something like ``['localhost', '127.0.0.1']`` for
481  
-    local development).
482  
-
483  
-A couple more things to note about 404 views:
484  
-
485  
-* If :setting:`DEBUG` is set to ``True`` (in your settings module) then your
486  
-  404 view will never be used (and thus the ``404.html`` template will never
487  
-  be rendered) because the traceback will be displayed instead.
488  
-
489  
-* The 404 view is also called if Django doesn't find a match after checking
490  
-  every regular expression in the URLconf.
491  
-
492  
-Write a 500 (server error) view
493  
-===============================
494  
-
495  
-Similarly, your root URLconf may define a ``handler500``, which points
496  
-to a view to call in case of server errors. Server errors happen when
497  
-you have runtime errors in view code.
498  
-
499  
-Likewise, you should create a ``500.html`` template at the root of your
500  
-template directory and add some content like "Something went wrong".
501  
-
502 457
 Use the template system
503 458
 =======================
504 459
 
5  docs/intro/whatsnext.txt
@@ -66,6 +66,11 @@ different needs:
66 66
   where you'll turn to find the details of a particular function or
67 67
   whathaveyou.
68 68
 
  69
+* If you are interested in deploying a project for public use, our docs have
  70
+  :doc:`several guides</howto/deployment/index>` for various deployment
  71
+  setups as well as a :doc:`deployment checklist</howto/deployment/checklist>`
  72
+  for some things you'll need to think about.
  73
+
69 74
 * Finally, there's some "specialized" documentation not usually relevant to
70 75
   most developers. This includes the :doc:`release notes </releases/index>` and
71 76
   :doc:`internals documentation </internals/index>` for those who want to add
14  docs/topics/http/views.txt
@@ -140,18 +140,18 @@ The 404 (page not found) view
140 140
 
141 141
 .. function:: django.views.defaults.page_not_found(request, template_name='404.html')
142 142
 
143  
-When you raise an ``Http404`` exception, Django loads a special view devoted
144  
-to handling 404 errors. By default, it's the view
145  
-``django.views.defaults.page_not_found``, which either produces a very simple
146  
-"Not Found" message or loads and renders the template ``404.html`` if you
147  
-created it in your root template directory.
  143
+When you raise :exc:`~django.http.Http404` from within a view, Django loads a
  144
+special view devoted to handling 404 errors. By default, it's the view
  145
+:func:`django.views.defaults.page_not_found`, which either produces a very
  146
+simple "Not Found" message or loads and renders the template ``404.html`` if
  147
+you created it in your root template directory.
148 148
 
149 149
 The default 404 view will pass one variable to the template: ``request_path``,
150 150
 which is the URL that resulted in the error.
151 151
 
152 152
 The ``page_not_found`` view should suffice for 99% of Web applications, but if
153  
-you want to override it, you can specify ``handler404`` in your URLconf, like
154  
-so::
  153
+you want to override it, you can specify ``handler404`` in your root URLconf
  154
+(setting ``handler404`` anywhere else will have no effect), like so::
155 155
 
156 156
     handler404 = 'mysite.views.my_custom_404_view'
157 157
 

0 notes on commit 31ee120

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