Skip to content
Snippets Groups Projects
Select Git revision
  • 34dca4f23fdcce88487f6e8d61b61402ac361541
  • master default protected
2 results

heyheylibrary

heyHeyLibrary

image.png

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

GPLv3 License wakatime

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 [at] radialbog9 [dot] uk) or a discord message (radialbog9) so I can have a look!

Run Locally

Install for development in a venv with Python:

git clone https://git.rb9.xyz/TheJoeCoder/heyheylibrary
cd heyheylibrary
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.

Or, via docker:

# 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

License

GPL 3.0