Home>

Create training projects on Django and using the POSTGRESQL database, actually there is a couple of moments where I'm confused. When creating a new database setup project at Django Next:

databases= {
    'Default': {
        'Engine': 'django.db.backends.postgreSQL',
        'Name': 'MyDatabase',
        'User': 'MyDatabaseUser',
        'Password': 'MyPassword',
        'HOST': '127.0.0.1',
        'Port': '5432',
    }
}

For the previous project, I created a new user, a new database, and set a password. Questions:

  1. password which I asked it for a user, or for a database?
  2. In the new project, under the same user, you need to create a new database and simply change the value of the "name" string?
  3. How to find out what databases were created from a particular user?
  • Answer # 1
    1. password which I asked it for a user, or for a database?

    for user

    1. In the new project, under the same user, you need to create a new database and simply change the value of the "name" string?

    Create a new base

    1. How to find out what databases were created from a particular user?

    List of all databases on the server can be viewed through PSQL Team \ L. or request:

    select * from pg_catalog.pg_database;
    

    And the list for a specific user can be obtained by a request:

    Select * from pg_catalog.pg_database
    Where pg_catalog.pg_get_userbyid (datdba)= 'MyDatabaseUser';
    
  • Answer # 2
    1. password which I asked it for a user, or for a database?

    for user

    1. In the new project, under the same user, you need to create a new database and simply change the value of the "name" string?

    Create a new base

    1. How to find out what databases were created from a particular user?

    List of all databases on the server can be viewed through PSQL Team \ L. or request:

    select * from pg_catalog.pg_database;
    

    And the list for a specific user can be obtained by a request:

    Select * from pg_catalog.pg_database
    Where pg_catalog.pg_get_userbyid (datdba)= 'MyDatabaseUser';