Ticket #22620: 22620.diff

File 22620.diff, 2.3 KB (added by Tim Graham, 10 years ago)
  • docs/topics/db/multi-db.txt

    diff --git a/docs/topics/db/multi-db.txt b/docs/topics/db/multi-db.txt
    index 9a735c3..bf94dcc 100644
    a b If the concept of a ``default`` database doesn't make sense in the context  
    4747of your project, you need to be careful to always specify the database
    4848that you want to use. Django requires that a ``default`` database entry
    4949be defined, but the parameters dictionary can be left blank if it will not be
    50 used. The following is an example ``settings.py`` snippet defining two
    51 non-default databases, with the ``default`` entry intentionally left empty::
     50used. You must setup :setting:`DATABASE_ROUTERS` for all of your apps' models,
     51including those in any contrib and third-party apps you are using, so that no
     52queries are routed to the default database in order to do this. The following
     53is an example ``settings.py`` snippet defining two non-default databases, with
     54the ``default`` entry intentionally left empty::
    5255
    5356    DATABASES = {
    5457        'default': {},
    particular database, you can define a :ref:`database  
    8790router<topics-db-multi-db-routing>` that implements a policy
    8891constraining the availability of particular models.
    8992
    90 Alternatively, if you want fine-grained control of synchronization,
    91 you can pipe all or part of the output of :djadmin:`sqlall` for a
    92 particular application directly into your database prompt, like this::
    93 
    94     $ ./manage.py sqlall sales | ./manage.py dbshell
    95 
    9693Using other management commands
    9794-------------------------------
    9895
    In addition, some objects are automatically created just after  
    692689
    693690For common setups with multiple databases, it isn't useful to have these
    694691objects in more than one database. Common setups include primary/replica and
    695 connecting to external databases. Therefore, it's recommended:
    696 
    697 - either to run :djadmin:`migrate` only for the default database;
    698 - or to write :ref:`database router<topics-db-multi-db-routing>` that allows
    699   synchronizing these three models only to one database.
     692connecting to external databases. Therefore, it's recommended to write
     693:ref:`database router<topics-db-multi-db-routing>` that allows synchronizing
     694these three models only to one database. Use the same approach for contrib
     695and third-party apps that don't need their tables in multiple databases.
    700696
    701697.. warning::
    702698
Back to Top