Capture Photos from Events!
EventPics is a simple Django application designed to capture photos from events. Built using Django, Bootstrap 5.3, Bootstrap Icons, and PostgreSQL. It provides a simple interface for uploading, viewing and downloading photos from events.
- User Authentication: Login and logout functionality.
- Gallery Management: Create and manage multiple galleries.
- Photo Upload: Upload multiple photos to a gallery.
- Photo Download: Download selected photos from a gallery.
- Access Control: Restrict access to galleries based on user permissions.
- Responsive Design: Mobile-friendly interface using Bootstrap 5.
- Dark Mode: Toggle between light and dark modes.
- S3 Integration: Store photos using compatible S3 object storage services.
Note
Gallery Management and Access Control features are only available at /admin
to authenticated users with the Django is_staff
permission.
EventPics uses the django-storages
library to store photos in an S3 bucket. For EventPics to function you must set the following environment variables in the .env
file:
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_STORAGE_BUCKET_NAME=
AWS_S3_REGION_NAME=
AWS_S3_ENDPOINT_URL=
The django-storages
documentation provides instructions for configuration with S3 compatible object storage services.
Note
S3 Cross Origin Resource Sharing (CORS) Configuration:
To allow objects in S3 to load in EventPics you must configure the CORS settings for the bucket to be the origin of the application. This will be the FQDN of the application, e.g. https://eventpics.example.com
.
-
Clone the repository:
git clone https://github.com/dbrennand/EventPics && cd EventPics/docker
-
Create the
.env
file from the example:cp .env.example .env
-
Populate the
.env
file with your environment variables:nano .env
-
Deploy the application using Docker Compose:
docker compose up -d
By default the application will be available over HTTPS at localhost
. The default configuration is for development purposes and should not be used in production. The provided docker-compose.yml
file uses Caddy as a reverse proxy.
For production deployments, modify the Caddyfile
to issue certificates using Let's Encrypt via the HTTP-01 challenge.
Below is a minimal example Caddyfile configuration:
{
email hello@example.com
}
eventpics.example.com {
reverse_proxy eventpics:8000
}
Note
The steps below are for development only. Use these steps only if you plan on working on the application.
Initialise the development environment:
# Create the Python virtual environment
python -m venv .venv
# Activate the Python virtual environment
source .venv/bin/activate
# Install the required dependencies
pip install -r requirements-dev.txt
# Install the pre-commit hooks
pre-commit install
If you need to create Django migrations for changes to the models:
cd eventpics
python manage.py makemigrations gallery
Build and test the application using Docker Compose:
# These steps assume you've created and configured the .env file
cd docker
docker compose -f docker-compose-dev.yml up -d --build