-
Notifications
You must be signed in to change notification settings - Fork 0
Database

Further details are provided in the documentation within the repository. Please see the section on generating the project documentation for more information.
To create the database for the first time, a virtual environment should be created, the requirements should be installed from the "requirements.txt" file using pip and the environment should be activated.
With the pre-requisites in place, an empty database with the correct schema in place can be created by running the following commands from the root of the project:
$env:NATURE_RECORDER_DB="$pwd\data\naturerecorder.db"
$env:PYTHONPATH="$pwd\src"
python -m naturerec_modelexport NATURE_RECORDER_DB="`pwd`/data/naturerecorder.db"
export PYTHONPATH=`pwd`/src
python -m naturerec_modelThis will create a database called "naturerecorder.db" in the "data" sub-folder of the working copy from which the commands are run. To create the database elsewhere, change the path assigned to the NATURE_RECORDER_DB environment variable.
Once the database has been created, enter the following commands from the root of the project to prompt for a username and password and add that user to the database:
$env:NATURE_RECORDER_DB="$pwd\data\naturerecorder.db"
$env:PYTHONPATH="$pwd\src"
python -m naturerec_modelexport NATURE_RECORDER_DB="`pwd`/data/naturerecorder.db"
export PYTHONPATH=`pwd`/src
python add_user.pyThis creates the user in the copy of the database in the "data" sub-folder of the working copy from which the commands are run. To create the user in a database held elsewhere, change the path assigned to the NATURE_RECORDER_DB environment variable.