config/database.py
.DB_CONFIG_PATH
and should contain the relative path to the configuration file--config
or -C
flag.DB_CONFIG_PATH
will take precedance if defined and will default to config/database.py
if not defined.DATABASES
variable with a dictionary of connection details. Each key will be the name of our connection. The connection name can be whatever you like and does not need to relate to a database name. Common connection names could be something like dev
, prod
and staging
. Feel free to name these connections whatever you like.ConnectionResolver
class and and register the connection details. Normal convention is to set this to a variable called DB
:db_url
helper and use it to define the connectionDATABASE_URL
environment variable by default. If you want to use an other environment variable you just have to do:db_url
:config/database.py
file through the log_queries
boolean parameter.config/database.py
file you can put on the bottom here. The StreamHandler will output the queries to the terminal.DB
you can import it like: