Opened 6 years ago

Last modified 6 years ago

#19775 closed Bug

database configuration without "default" not supported — at Version 1

Reported by: monkut Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords: multipledbs
Cc: warren@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Claude Paroz)

For version 1.4 and dev documentation on multiple databases the text seems to imply that you can choose not to define a "default" db

... Django uses the database with the alias of default when no other database has been selected. If you don’t have a default database, you need to be careful to always specify the database that you want to use.

However, when you actually remove, or do not include a "default" and attempt to syncdb with Postgresql, you get the following error that explicitly tells you, that you *must* define a "default" database:

>python syncdb
Traceback (most recent call last):
  File "", line 16, in <module>
  File "C:\Python27\lib\site-packages\django\core\management\", line 459, in execute_manager
  File "C:\Python27\lib\site-packages\django\core\management\", line 382, in execute
  File "C:\Python27\lib\site-packages\django\core\management\", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "C:\Python27\lib\site-packages\django\core\management\", line 69, in load_command_class
    module = import_module('' % (app_name, name))
  File "C:\Python27\lib\site-packages\django\utils\", line 35, in import_module
  File "C:\Python27\lib\site-packages\django\core\management\commands\", line 8, in <module>
    from import custom_sql_for_model, emit_post_sync_signal
  File "C:\Python27\lib\site-packages\django\core\management\", line 6, in <module>
    from django.db import models
  File "C:\Python27\lib\site-packages\django\db\", line 12, in <module>
    raise ImproperlyConfigured("You must define a '%s' database" % DEFAULT_DB_ALIAS)
django.core.exceptions.ImproperlyConfigured: You must define a 'default' database

Change History (1)

comment:1 Changed 6 years ago by Claude Paroz

Description: modified (diff)
Triage Stage: UnreviewedAccepted

I think that not depending on a specific database alias might be a desirable goal for the future. However, this will need some more cleanup regarding django.db.connection (see for example #13528).

Meanwhile, updating the documentation seems the right thing to do at short term.

Note: See TracTickets for help on using tickets.
Back to Top