I think there is some confusion as to what dbshell does. From the documentation:
Runs the command-line client for the database engine specified in your
ENGINE setting, with the connection parameters specified in your USER,
PASSWORD, etc., settings.
- For PostgreSQL, this runs the
psql
command-line client.
- For MySQL,
this runs the
mysql
command-line client.
- For SQLite, this runs the
sqlite3
command-line client.
This command assumes the programs are on your PATH so that a simple
call to the program name (psql, mysql, sqlite3) will find the program
in the right place. There’s no way to specify the location of the
program manually.
Its not like manage.py shell
, dbshell
just runs the normal shell for the database configured, except it logs you in with the credentials in settings.py
.
This means, if you are using postgresql, you need to have the psql
command already installed in order for dbshell
to work. This command is not part of Python, but comes with the postgresql server.
In order words - if all you have installed is psycopg2, the dbshell
command will not work.