api database - PARC-projects/video-query-home GitHub Wiki
The Video Query project uses PostgresSQL for it database needs. A default database is seeded and managed through Django Migrations.
To create and setup your database, perform the following steps:
- Create a database named "Video-Query". One can use a PostgreSQL management tool like pgAdmin, or within psql execute
CREATE DATABASE <database name>
Also, make sure the necessary environment variables are set, e.g. by sourcing a secrets.sh file.
- Navigate to
..\video-query-api\src
and run the Django migrations. (Note: The makemigrations command is only needed if you change the models or remove a migration after cloning our repository.)
python3 manage.py makemigrations
python3 manage.py migrate
or
python manage.py makemigrations
python manage.py migrate
- Create a Django superuser
python3 manage.py createsuperuser
or
python manage.py createsuperuser
- Regardless if you are deploying in dev or production, run the following fixture to load lookup tables.
python3 manage.py loaddata 1-lookups
or
python manage.py loaddata 1-lookups
For more information on loading the database with video clip deep learning Features, please head on over to the Video Query Algorithms wiki.
For testing during development, we have provided various fixtures. The data in these fixtures represents a mix of queries, some that should execute without errors and others that should give different error states. These error states allow testing of whether the system is properly catching and reporting errors. You can seed this test data from our repository by executing the following:
python3 manage.py loaddata 2-dev-video 3-dev-search-set 4-dev-query 5-dev-results 6-dev-features 7-dev-video-clip
or
python manage.py loaddata 2-dev-video 3-dev-search-set 4-dev-query 5-dev-results 6-dev-features 7-dev-video-clip