Question

The question is self explanatory. Kindly provide the valuable knowledge. Thanks.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', 
        'NAME': 'gingr_cc',                     
        'USER': '',
        'PASSWORD': '',
        'HOST': '',                     
        'PORT': '', 
    },
 'launchg': {     // This name
    'NAME': 'launchg',        // VS This name
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'root',
    'PASSWORD': '',
    'HOST': '127.0.0.1',   
    'PORT': '3306',        
}
Was it helpful?

Solution

If you have more than one database, the name you refer to the second database with is the key in the DATABASES dictionary:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', 
        'NAME': 'gingr_cc',                     
        'USER': '',
        'PASSWORD': '',
        'HOST': '',                     
        'PORT': '', 
    },
    'second_db': {  # This is the "friendly name" that you will use with django
        'NAME': 'launchg', # This is the name of the database on the server
        'ENGINE': 'django.db.backends.mysql',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': '127.0.0.1',   
        'PORT': '3306',        
}

So, if you want to use syncdb with the second database:

python manage.py syncdb --database=second_db

The documentation has more information and examples on use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top