Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
3493f18d
Kaydet (Commit)
3493f18d
authored
Haz 30, 2013
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.6.x] Fixed #20667 - Removed discussion of DEBUG from tutorial.
Backport of 0d642aac86 from master.
üst
02976a46
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
52 deletions
+27
-52
checklist.txt
docs/howto/deployment/checklist.txt
+15
-0
tutorial03.txt
docs/intro/tutorial03.txt
+0
-45
whatsnext.txt
docs/intro/whatsnext.txt
+5
-0
views.txt
docs/topics/http/views.txt
+7
-7
No files found.
docs/howto/deployment/checklist.txt
Dosyayı görüntüle @
3493f18d
...
...
@@ -206,6 +206,21 @@ See :doc:`/howto/error-reporting` for details on error reporting by email.
.. _Sentry: http://sentry.readthedocs.org/en/latest/
Customize the default error views
---------------------------------
Django includes default views and templates for several HTTP error codes. You
may want to override the default templates by creating the following templates
in your root template directory: ``404.html``, ``500.html``, ``403.html``, and
``400.html``. The default views should suffice for 99% of Web applications, but
if you desire to customize them, see these instructions which also contain
details about the default templates:
* :ref:`http_not_found_view`
* :ref:`http_internal_server_error_view`
* :ref:`http_forbidden_view`
* :ref:`http_bad_request_view`
Miscellaneous
=============
...
...
docs/intro/tutorial03.txt
Dosyayı görüntüle @
3493f18d
...
...
@@ -454,51 +454,6 @@ just as :func:`~django.shortcuts.get_object_or_404` -- except using
:meth:`~django.db.models.query.QuerySet.get`. It raises
:exc:`~django.http.Http404` if the list is empty.
Write a 404 (page not found) view
=================================
When you raise :exc:`~django.http.Http404` from within a view, Django
will load a special view devoted to handling 404 errors. It finds it
by looking for the variable ``handler404`` in your root URLconf (and
only in your root URLconf; setting ``handler404`` anywhere else will
have no effect), which is a string in Python dotted syntax -- the same
format the normal URLconf callbacks use. A 404 view itself has nothing
special: It's just a normal view.
You normally won't have to bother with writing 404 views. If you don't set
``handler404``, the built-in view :func:`django.views.defaults.page_not_found`
is used by default. Optionally, you can create a ``404.html`` template
in the root of your template directory. The default 404 view will then use that
template for all 404 errors when :setting:`DEBUG` is set to ``False`` (in your
settings module). If you do create the template, add at least some dummy
content like "Page not found".
.. warning::
If :setting:`DEBUG` is set to ``False``, all responses will be
"Bad Request (400)" unless you specify the proper :setting:`ALLOWED_HOSTS`
as well (something like ``['localhost', '127.0.0.1']`` for
local development).
A couple more things to note about 404 views:
* If :setting:`DEBUG` is set to ``True`` (in your settings module) then your
404 view will never be used (and thus the ``404.html`` template will never
be rendered) because the traceback will be displayed instead.
* The 404 view is also called if Django doesn't find a match after checking
every regular expression in the URLconf.
Write a 500 (server error) view
===============================
Similarly, your root URLconf may define a ``handler500``, which points
to a view to call in case of server errors. Server errors happen when
you have runtime errors in view code.
Likewise, you should create a ``500.html`` template at the root of your
template directory and add some content like "Something went wrong".
Use the template system
=======================
...
...
docs/intro/whatsnext.txt
Dosyayı görüntüle @
3493f18d
...
...
@@ -66,6 +66,11 @@ different needs:
where you'll turn to find the details of a particular function or
whathaveyou.
* If you are interested in deploying a project for public use, our docs have
:doc:`several guides</howto/deployment/index>` for various deployment
setups as well as a :doc:`deployment checklist</howto/deployment/checklist>`
for some things you'll need to think about.
* Finally, there's some "specialized" documentation not usually relevant to
most developers. This includes the :doc:`release notes </releases/index>` and
:doc:`internals documentation </internals/index>` for those who want to add
...
...
docs/topics/http/views.txt
Dosyayı görüntüle @
3493f18d
...
...
@@ -140,18 +140,18 @@ The 404 (page not found) view
.. function:: django.views.defaults.page_not_found(request, template_name='404.html')
When you raise
an ``Http404`` exception, Django loads a special view devoted
to handling 404 errors. By default, it's the view
``django.views.defaults.page_not_found``, which either produces a very simple
"Not Found" message or loads and renders the template ``404.html`` if you
created it in your root template directory.
When you raise
:exc:`~django.http.Http404` from within a view, Django loads a
special view devoted
to handling 404 errors. By default, it's the view
:func:`django.views.defaults.page_not_found`, which either produces a very
simple "Not Found" message or loads and renders the template ``404.html`` if
you
created it in your root template directory.
The default 404 view will pass one variable to the template: ``request_path``,
which is the URL that resulted in the error.
The ``page_not_found`` view should suffice for 99% of Web applications, but if
you want to override it, you can specify ``handler404`` in your
URLconf, like
so::
you want to override it, you can specify ``handler404`` in your
root URLconf
(setting ``handler404`` anywhere else will have no effect), like
so::
handler404 = 'mysite.views.my_custom_404_view'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment