A super simple Django site recreating the unix fortune command using an LLM as an infinite fortune creator. (https://en.wikipedia.org/wiki/Fortune_(Unix))
Uses https://pypi.org/project/chatgptpy/ to communicate with a locally hosted LLM server or LLM server on the local network that uses the OpenAI api format. (Requires Python 3.9.x or newer.)
sudo apt-get install python3.11
sudo apt install python3.11-venv
python3.11 -m venv env
pip install django
pip install chatgptpy
source env/bin/activate && cd fortune
django-admin startproject fortune
python manage.py migrate
Add to fortune/settings.py:
APPEND_SLASH=True
DEBUG=False
if prod, DEBUG=True
if dev.
ALLOWED_HOSTS=[
'127.0.0.1',
'fortune.whitney.rip'
]
Visible at http://127.0.0.1:8000
python manage.py migrate && python manage.py runserver
docker-compose build && docker-compose up -d && docker logs -f fortune