Search code examples
djangodatabasepostgresqlpgadminpgadmin-4

i'm not able to create another database in postgres with django after creating the first one


i'm using django in all my projects and in my first project i changed the database from sql lite normally i created a server group then the server and the DB etc.. and changed the settings.py file of the project with the according configuration

DATABASES = {
    'default': {
      'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'myDatabaseName',
        'USER': 'postgres',
        'PASSWORD': 'MyPassword',
        'HOST': 'localhost', 
        'PORT': '5432',
    }

and after about a month i started another project with django and ofc i needed a database and whenever i create another database it automatically associates it with the earlier one and it automatically have the same tables with earlier one so i need the steps to create another database with diffrent models and tables , thank you


Solution

  • try creating new database along with new user and new password, and copy paste those value in settings, and make sure you don't have any other settings overriding your base settings (if using multiple settings), also i would suggest you to create username, password, and database name with same name

    Thanks