[Answer]-Difference between Database name and 'name' parameter inside database

1๐Ÿ‘

โœ…

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.

๐Ÿ‘คBurhan Khalid

Leave a comment