PostgresPostgres is one of the most popular database system. If you would like to have a more serious application running in production mode, you have to choose a database different from the default sqlite3 in Django. Next, I will give two examples of managing databases. The first one is pgAdmin, which is a graphical development platform for PostgreSQL, and the second one is the conventional command-line interface.
Download and install Postgres!
https://www.postgresql.org/...
With installation you will get also pgAdmin.
After the installation you can use pgAdmin which is a graphical tool for managing and developing databases.
You can create databases, tables with pgAdmin easily.
After you have created a local database, you can access it with pgAdmin.
If you would like to access your database in production, follow the steps below:
1. Log in to your Heroku dashboard https://dashboard.heroku.com/apps
2. Click on your app name in the list!
3. Select 'Resources' from the menu top of the page!
4. Click on 'Heroku postgres'!
5. Select 'Settings'!
6. Click on 'View Credentials' next to 'Database Credentials'!
7. Open pgAdmin!
8. 'Servers' + right click, then select Create > Server!
9. Fill the empty fields with datas based on the Heroku credentials!
On the page of 'View credentials' you can read the next warning: "Please note that these credentials are not permanent. Heroku rotates credentials periodically and updates applications where this database is attached."
So, you have to update the credentials in pgAdmin later. In order to avoid this, you should use CLI instead!
To manage your database either locally or in production you can use CLI alternatively.
Open your command-line interface or shell!
Another way to manage your database with Postgres is CLI.
$ heroku pg:psql
With this command you will connect to your database on Heroku. Type \c to connect, then \d to see the schema.
$ psql -U postgres
Entering to local 'postgres' database with username 'postgres'. After you entered this command you have to add your password.
$ postgres-# \c postgres
Connecting to the 'postgres' database.
$ postgres-# \d
Checking your database schema.
To exit from the database, just type exit!
You can create your own database then refer to its name inside your .env file. I will create a database with the name 'mysite'.
$ postgres-# CREATE DATABASE mysite WITH OWNER postgres;
That's it! By the way you can apply sql queries not only in pgAdmin but from command-line as well. For example:
$ SELECT * FROM django_migrations WHERE app='accounts';
This means you have selected all records of accounts app from 'django_migrations' table.
You can do more and more complex queries of course depending on your sql skills and database size.