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
5ecead9a
Kaydet (Commit)
5ecead9a
authored
Agu 26, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22620 -- Emphasized role of DATABASE_ROTERS in multi-db docs.
Thanks Mike O'Connor for the suggestions.
üst
7b9537fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
multi-db.txt
docs/topics/db/multi-db.txt
+9
-13
No files found.
docs/topics/db/multi-db.txt
Dosyayı görüntüle @
5ecead9a
...
...
@@ -45,8 +45,11 @@ If the concept of a ``default`` database doesn't make sense in the context
of your project, you need to be careful to always specify the database
that you want to use. Django requires that a ``default`` database entry
be defined, but the parameters dictionary can be left blank if it will not be
used. The following is an example ``settings.py`` snippet defining two
non-default databases, with the ``default`` entry intentionally left empty::
used. You must setup :setting:`DATABASE_ROUTERS` for all of your apps' models,
including those in any contrib and third-party apps you are using, so that no
queries are routed to the default database in order to do this. The following
is an example ``settings.py`` snippet defining two non-default databases, with
the ``default`` entry intentionally left empty::
DATABASES = {
'default': {},
...
...
@@ -85,12 +88,6 @@ particular database, you can define a :ref:`database
router<topics-db-multi-db-routing>` that implements a policy
constraining the availability of particular models.
Alternatively, if you want fine-grained control of synchronization,
you can pipe all or part of the output of :djadmin:`sqlall` for a
particular application directly into your database prompt, like this::
$ ./manage.py sqlall sales | ./manage.py dbshell
Using other management commands
-------------------------------
...
...
@@ -690,11 +687,10 @@ In addition, some objects are automatically created just after
For common setups with multiple databases, it isn't useful to have these
objects in more than one database. Common setups include primary/replica and
connecting to external databases. Therefore, it's recommended:
- either to run :djadmin:`migrate` only for the default database;
- or to write :ref:`database router<topics-db-multi-db-routing>` that allows
synchronizing these three models only to one database.
connecting to external databases. Therefore, it's recommended to write a
:ref:`database router<topics-db-multi-db-routing>` that allows synchronizing
these three models to only one database. Use the same approach for contrib
and third-party apps that don't need their tables in multiple databases.
.. warning::
...
...
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