Ticket #20667: 20667.diff
File 20667.diff, 5.7 KB (added by , 11 years ago) |
---|
-
docs/howto/deployment/checklist.txt
diff --git a/docs/howto/deployment/checklist.txt b/docs/howto/deployment/checklist.txt index 1a23567..4ec0c26 100644
a b 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 -
docs/intro/tutorial03.txt
diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt index 9140984..777b8ef 100644
a b 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) view458 =================================459 460 When you raise :exc:`~django.http.Http404` from within a view, Django461 will load a special view devoted to handling 404 errors. It finds it462 by looking for the variable ``handler404`` in your root URLconf (and463 only in your root URLconf; setting ``handler404`` anywhere else will464 have no effect), which is a string in Python dotted syntax -- the same465 format the normal URLconf callbacks use. A 404 view itself has nothing466 special: It's just a normal view.467 468 You normally won't have to bother with writing 404 views. If you don't set469 ``handler404``, the built-in view :func:`django.views.defaults.page_not_found`470 is used by default. Optionally, you can create a ``404.html`` template471 in the root of your template directory. The default 404 view will then use that472 template for all 404 errors when :setting:`DEBUG` is set to ``False`` (in your473 settings module). If you do create the template, add at least some dummy474 content like "Page not found".475 476 .. warning::477 478 If :setting:`DEBUG` is set to ``False``, all responses will be479 "Bad Request (400)" unless you specify the proper :setting:`ALLOWED_HOSTS`480 as well (something like ``['localhost', '127.0.0.1']`` for481 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 your486 404 view will never be used (and thus the ``404.html`` template will never487 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 checking490 every regular expression in the URLconf.491 492 Write a 500 (server error) view493 ===============================494 495 Similarly, your root URLconf may define a ``handler500``, which points496 to a view to call in case of server errors. Server errors happen when497 you have runtime errors in view code.498 499 Likewise, you should create a ``500.html`` template at the root of your500 template directory and add some content like "Something went wrong".501 502 457 Use the template system 503 458 ======================= 504 459 -
docs/intro/whatsnext.txt
diff --git a/docs/intro/whatsnext.txt b/docs/intro/whatsnext.txt index a677bc9..638d219 100644
a b 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 -
docs/topics/http/views.txt
diff --git a/docs/topics/http/views.txt b/docs/topics/http/views.txt index 5c27c9c..ebe5302 100644
a b 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 devoted144 to handling 404 errors. By default, it's the view145 ``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, like154 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