Ticket #20667: 20667.diff

File 20667.diff, 5.7 KB (added by Tim Graham, 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.  
    206206
    207207    .. _Sentry: http://sentry.readthedocs.org/en/latest/
    208208
     209Customize the default error views
     210---------------------------------
     211
     212Django includes default views and templates for several HTTP error codes. You
     213may want to override the default templates by creating the following templates
     214in 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
     216if you desire to customize them, see these instructions which also contain
     217details 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
    209224Miscellaneous
    210225=============
    211226
  • 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  
    454454:meth:`~django.db.models.query.QuerySet.get`. It raises
    455455:exc:`~django.http.Http404` if the list is empty.
    456456
    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 
    502457Use the template system
    503458=======================
    504459
  • docs/intro/whatsnext.txt

    diff --git a/docs/intro/whatsnext.txt b/docs/intro/whatsnext.txt
    index a677bc9..638d219 100644
    a b different needs:  
    6666  where you'll turn to find the details of a particular function or
    6767  whathaveyou.
    6868
     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
    6974* Finally, there's some "specialized" documentation not usually relevant to
    7075  most developers. This includes the :doc:`release notes </releases/index>` and
    7176  :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  
    140140
    141141.. function:: django.views.defaults.page_not_found(request, template_name='404.html')
    142142
    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.
     143When you raise :exc:`~django.http.Http404` from within a view, Django loads a
     144special 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
     146simple "Not Found" message or loads and renders the template ``404.html`` if
     147you created it in your root template directory.
    148148
    149149The default 404 view will pass one variable to the template: ``request_path``,
    150150which is the URL that resulted in the error.
    151151
    152152The ``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::
     153you want to override it, you can specify ``handler404`` in your root URLconf
     154(setting ``handler404`` anywhere else will have no effect), like so::
    155155
    156156    handler404 = 'mysite.views.my_custom_404_view'
    157157
Back to Top