This project contains four parts:
- Python Django backend serving the web application
- Postgres database for storing user data
- ElasticSearch database for documents with search API [docker]
- Text2Text API for automatic screening
As a minimum, you need to install the first two parts.
Project was tested on Python 3.12. It will not run on Python 3.8 and below because of type hints for generics. You need to install uv
in order to run the project.
npm install bulma-calendar
Start psql and open database:
$ bash setup.sh
Update the DATABASE_URL entry in the .env
file (see 2.1 Before first run). Replace SYSTEM_USERNAME
with your system username and YOUR_PASSWORD
with your desired database password.
DATABASE_URL=postgres://SYSTEM_USERNAME:YOUR_PASSWORD@localhost:5433/cruise_literature
Check backend API documentation to learn more about installation.
In order to use CORE search API create a file data/core_api_key.txt
and insert your API key.
Next, change SEARCH_WITH_CORE
to True
in cruise_literature/settings.py
.
It is a separate flask
application that can be used to generate text predictions (question answering, summarisation)
for a given text and classify texts using binary classification.
It is not necessary and can be switched off in the cruise_literature/settings.py
by setting:
ML_API = False
Check prompt_API documentation to learn more about installation.
This fields will also apply after making some changes or updating the code, when the database could be out of sync with the code.
In the top level directory of the project, create a .env
file and fill it with the following fields:
DATABASE_URL=postgres://user:password@host:port/dbname
Go into src/cruise_literature/
directory:
(cruise-literature)$ cd src/cruise_literature/
Create .env
file in that directory and fill it with the following fields (read more):
DEBUG=True
SECRET_KEY=your-secret-django-key
ALLOWED_HOSTS=
DATABASE_URL=postgres://user:password@host:port/dbname
Make migrations and migrate the database
(cruise-literature)$ python manage.py makemigrations
(cruise-literature)$ python manage.py migrate
Create superuser:
(cruise-literature)$ python manage.py createsuperuser
Fill in sample data into the database
(cruise-literature)$ python manage.py loaddata users_data.json
(cruise-literature)$ python manage.py loaddata search_engines.json
To start the Postgres database, run on macOS:
$ pg_ctl -D /opt/homebrew/var/postgresql@14 start
Finally, run Django server
(cruise-literature)$ python manage.py runserver 8000
Server should be available at http://127.0.0.1:8000/
Add YOUR_IP
to ALLOWED_HOSTS
in .env
file, for example:
ALLOWED_HOSTS=123.456.789.0
In the src/backend/search_app/docker-compose.yml
file modify the IP address in the following line:
network.host=0.0.0.0
Run Django server:
(cruise-literature)$ python manage.py runserver YOUR_IP:YOUR_PORT