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
deb561bb
Kaydet (Commit)
deb561bb
authored
Nis 13, 2014
tarafından
Víðir Valberg Guðmundsson
Kaydeden (comit)
Tim Graham
Nis 25, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22422 -- Moved information about the application loading process to refs/applications.txt.
üst
3776926c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
35 deletions
+44
-35
applications.txt
docs/ref/applications.txt
+42
-0
1.7.txt
docs/releases/1.7.txt
+2
-35
No files found.
docs/ref/applications.txt
Dosyayı görüntüle @
deb561bb
...
@@ -306,3 +306,45 @@ Application registry
...
@@ -306,3 +306,45 @@ Application registry
Raises :exc:`~exceptions.LookupError` if no such application or model
Raises :exc:`~exceptions.LookupError` if no such application or model
exists. Raises :exc:`~exceptions.ValueError` when called with a single
exists. Raises :exc:`~exceptions.ValueError` when called with a single
argument that doesn't contain exactly one dot.
argument that doesn't contain exactly one dot.
.. _application-loading-process:
Application loading process
===========================
Django loads application configurations and models as soon as it starts. Here
are some common problems you may encounter:
* ``RuntimeError: App registry isn't ready yet.`` This happens when importing
an application configuration or a models module triggers code that depends
on the app registry.
For example, :func:`~django.utils.translation.ugettext()` uses the app
registry to look up translation catalogs in applications. To translate at
import time, you need :func:`~django.utils.translation.ugettext_lazy()`
instead. (Using :func:`~django.utils.translation.ugettext()` would be a bug,
because the translation would happen at import time, rather than at each
request depending on the active language.)
Executing database queries with the ORM at import time in models modules
will also trigger this exception. The ORM cannot function properly until all
models are available.
Another common culprit is :func:`django.contrib.auth.get_user_model()`. Use
the :setting:`AUTH_USER_MODEL` setting to reference the User model at import
time.
* ``ImportError: cannot import name ...`` This happens if the import sequence
ends up in a loop.
To eliminate such problems, you should minimize dependencies between your
models modules and do as little work as possible at import time. To avoid
executing code at import time, you can move it into a function and cache its
results. The code will be executed when you first need its results. This
concept is known as "lazy evaluation".
* ``django.contrib.admin`` will now automatically perform autodiscovery of
``admin`` modules in installed applications. To prevent it, change your
:setting:`INSTALLED_APPS` to contain
``'django.contrib.admin.apps.SimpleAdminConfig'`` instead of
``'django.contrib.admin'``.
docs/releases/1.7.txt
Dosyayı görüntüle @
deb561bb
...
@@ -877,41 +877,8 @@ Start-up sequence
...
@@ -877,41 +877,8 @@ Start-up sequence
Django 1.7 loads application configurations and models as soon as it starts.
Django 1.7 loads application configurations and models as soon as it starts.
While this behavior is more straightforward and is believed to be more robust,
While this behavior is more straightforward and is believed to be more robust,
regressions cannot be ruled out. You may encounter the following exceptions:
regressions cannot be ruled out. See :ref:`application-loading-process` for
solutions to some problems you may encounter.
* ``RuntimeError: App registry isn't ready yet.`` This happens when importing
an application configuration or a models module triggers code that depends
on the app registry.
For example, :func:`~django.utils.translation.ugettext()` uses the app
registry to look up translation catalogs in applications. To translate at
import time, you need :func:`~django.utils.translation.ugettext_lazy()`
instead. (Using :func:`~django.utils.translation.ugettext()` would be a bug,
because the translation would happen at import time, rather than at each
request depending on the active language.)
Executing database queries with the ORM at import time in models modules
will also trigger this exception. The ORM cannot function properly until all
models are available.
Another common culprit is :func:`django.contrib.auth.get_user_model()`. Use
the :setting:`AUTH_USER_MODEL` setting to reference the User model at import
time.
* ``ImportError: cannot import name ...`` This happens if the import sequence
ends up in a loop.
To eliminate such problems, you should minimize dependencies between your
models modules and do as little work as possible at import time. To avoid
executing code at import time, you can move it into a function and cache its
results. The code will be executed when you first need its results. This
concept is known as "lazy evaluation".
* ``django.contrib.admin`` will now automatically perform autodiscovery of
``admin`` modules in installed applications. To prevent it, change your
:setting:`INSTALLED_APPS` to contain
``'django.contrib.admin.apps.SimpleAdminConfig'`` instead of
``'django.contrib.admin'``.
Standalone scripts
Standalone scripts
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^
...
...
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