2.1 KiB
Configuration
Database connection
- Should work with mysql or mariaDB databases
- if you do not have access to a database server, go back to index.md to read how to install one locally
To log into the database you need the host
, the database name
, the user
name, and the password
.
Note, the selected user needs at least read access on the selected database (True? maybe also write?).
The root of the fishbook package contains a file called template_dj_local_conf.json. copy this file to your project folder, i.e. the location from which you call your scripts, remove the template_
prefix and fill in database.host
, database.user
, database.password
.
The json template looks like this:
{
"database.host": "yourhost",
"database.user": "yourdatabaseusername",
"database.password": "yourdatabaseuserpassword",
"database.port": 3306,
"loglevel": "DEBUG",
"display.width": 14,
"display.limit": 7,
"safemode": false,
"connection.init_function": null
}
Example
Let's assume you are working remotely, i.e. connecting to a remote database on a server that has the name foo.uni-xyz.de
. The database is up and running and allows connections via port 3306 (the default). The database is called fish_db
and the user credentials are name baz
and password bar
. The configuration file will look like this:
{
"database.host": "foo.uni-xyz.de",
"database.user": "bar",
"database.password": "baz",
"database.port": 3306,
"loglevel": "DEBUG",
"display.width": 14,
"display.limit": 7,
"safemode": false,
"connection.init_function": null
}
In case you are working with a local database the database.host
entry is "localhost"
.
If you ommit database.user
or database.password
fishbook, respectively datajoint, will ask you for the user credentials every time you run your python scripts.
Note: This configuration file is pure text and can be easily read by anyone. It must not be part of public repository. Do not add it to your version control system!