A basic pure HTML+CSS gallery viewer in the vein of [PiGallery 2](https://bpatrik.github.io/pigallery2/) but meant to be compatible with somewhat old browsers.
To login a user should be manually created by running the following commands in the Django shell, substituting the user's name, email and password as needed:
from django.contrib.auth.models import User
user = User.objects.create_user('<USERNAME>', '<EMAIL>', '<PASSWORD>')
This project uses Django. The instructions below show how to run the site in a local/testing (development) mode and a simple release (production) mode. All commands assume you're in the repository root.
- Create and activate a virtualenv (recommended):
.venv/bin/python -m venv .venv
source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Configure environment variables in a `.env` file (the app reads `GALLERY_ROOT` and `THUMBNAILS_ROOT`). Example `.env` contents:
GALLERY_ROOT=/path/to/images
THUMBNAILS_ROOT=/path/to/thumb-cache
Development / testing mode
- Apply migrations and run the development server:
.venv/bin/python manage.py migrate
.venv/bin/python manage.py runserver
This runs Django's built-in development server (DEBUG mode). It's suitable for local testing and development only.
Release / production mode (simple guide)
- Collect static files and run with a WSGI server like `gunicorn` (example):
Set `DEBUG=False` and provide a proper `ALLOWED_HOSTS` value in your environment or settings when running in production. Use a reverse proxy (nginx) for serving static files and handling HTTPS in front of your WSGI server.
Running tests
- Run the full Django test suite:
.venv/bin/python manage.py test
- Useful focused test commands (fast iteration):
.venv/bin/python manage.py test viewer.test
.venv/bin/python manage.py test viewer.test.GalleryViewTests
.venv/bin/python manage.py test viewer.test.GalleryViewTests.test_search_action_url_uses_nested_path
- Sanity checks recommended before pushing changes:
- Keep `.env` local and out of version control; use `.env.example` as a template if you want to commit a sample file.
- For production deployments follow standard Django deployment guides (use a dedicated WSGI server, reverse proxy, secure secret management, and proper file permissions).