Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#16989 closed Bug (invalid)

Problem with DEFAULT_DB_ALIAS in settings

Reported by: sergeybe@… Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords: DEFAULT_DB_ALIAS settings
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

My settings.py has lines:

...
DEFAULT_DB_ALIAS = 'production'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', 
        'NAME': 'xxx.sqlite',              
        'USER': '',                      
        'PASSWORD': '',                  
        'HOST': '',                      
        'PORT': '',                      
    },
    'production':  {
        'ENGINE': 'django.db.backends.mysql', 
        'NAME': 'XXX',                      
        'USER': 'XXX',                      
        'PASSWORD': 'XXX',                  
        'HOST': 'localhost',                
        'PORT': '3306',                     
    },
}
...

When I run command "python manage.py syncdb" and Django creates sqlite database instead of MySQL database. It uses "default" alias instead of "production" alias. But next command works correctly "python manage.py syncdb --database=production".

I guess this is bug.

Change History (2)

comment:1 by Russell Keith-Magee, 13 years ago

Resolution: invalid
Status: newclosed

I'm not sure what gave you the idea that DEFAULT_DB_ALIAS is a setting, but it isn't. DEFAULT_DB_ALIAS is a constant, defined in the django.db module, that expands to "default".

I'm closing this invalid; however, If you can point to somewhere in the documentation that suggests that DEFAULT_DB_ALIAS is a setting, that might point to some documentation that needs to be corrected -- in which case, please provide details and reopen this ticket as a documentation issue.

comment:2 by anonymous, 11 years ago

Thought I'd chime in -- the DEFAULT_DB_ALIAS constant is required when using the python package "south".

https://pypi.python.org/pypi/South/

Not really a setting, but it IS a required constant when using South and running "syncdb", but clearly it is not a django issue.

Definitely invalid, but if anyone happens to find this know that it's a South thing and I'm pretty sure it's behaving as expected.

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