heyHeyLibrary
A library system written in Django to manage books. Suitable for someone with a bookshelf or for a whole library.
WARNING: While pretty much all features work properly, this software is not polished and probably shouldn't be used in production.
Badges
Demo
There is no demo server available at the moment, but you can run a demo locally by following the instructions in DEMO.md
Contributing
Contributions are always welcome! Fork the repo to another git service, make your changes, then drop me an email (joe[@]radialbog9[.]uk
without the square brackets) or a discord message (radialbog9
) so I can have a look!
If you find a bug, you can email the following address to create an issue: git[+]thejoecoder-heyheylibrary-28-issue-[@]rb9[.]xyz
(without the square brackets).
Run Locally
Install for development in a venv with Python:
# Clone the repo
git clone https://git.rb9.xyz/TheJoeCoder/heyheylibrary
cd heyheylibrary
# Create the venv in the `venv` directory and install the requirements
python -m venv venv
./venv/bin/python3 -m pip install -r requirements.txt
# Create the database
./venv/bin/python manage.py migrate
Then, to run the dev server:
./venv/bin/python manage.py runserver
Errors
If you get the following error:
ModuleNotFoundError: No module named 'pkg_resources'
... then you may need to install setuptools in your venv like so:
./venv/bin/python -m pip install setuptools
Deployment
Refer to the Django Wiki for deployment instructions.
There is also a docker image available at this repo: registry.rb9.xyz/thejoecoder/heyheylibrary
The tags are as follows:
-
latest
- The latest version (NOT recommended!) - A git branch name, e.g.
master
- The latest container built from that branch - A git tag name, e.g.
v1.0.0
- The image built from that tag (recommended for production!)
Additionally, a docker compose file is provided in the repo, which builds the app and runs it in a container. Here's how to do that:
# Clone the repo
git clone https://git.rb9.xyz/TheJoeCoder/heyheylibrary
cd heyheylibrary
# Copy the example .env files
cp .env.prod-example .env.prod
cp .env.prod.db-example .env.prod.db
cp .env.prod.search-example .env.prod.search
# Change the .env files to your liking here
# Build and run the containers
docker compose -f docker-compose.prod.yml up -d --build
# Create indexes for opensearch
docker compose -f docker-compose.prod.yml exec web python manage.py opensearch index create
# Apply the migrations
docker compose -f docker-compose.prod.yml exec web python manage.py migrate --noinput
# Collect the static files
docker compose -f docker-compose.prod.yml exec web python manage.py collectstatic --no-input --clear
The app should now be running on localhost:1337
Adding Social Login
Authentication is now provided via django-allauth, so refer to their documentation here.
For OpenID Connect, add the following to your local_settings.py file:
INSTALLED_APPS += [
'allauth.socialaccount.providers.openid_connect',
]
SOCIALACCOUNT_PROVIDERS = {
"openid_connect": {
"EMAIL_AUTHENTICATION": True, # Only add this line if you want existing accounts to be linked by email
"APPS": [
{
"provider_id": "my-server",
"name": "My Login Server",
"client_id": "your.service.id",
"secret": "your.service.secret",
"settings": {
"server_url": "https://my.server.example.com",
}
}
]
}
}
Tech Stack
Client: Bootstrap 5, JQuery
Server: Django, MySQL/SQLite/Postgres