Django Image Gallery
An image gallery application for Django projects. Provides an easy way to manage, organize, and display images through the Django admin interface and a reusable template tag.
Features
- Django model for managing gallery images
- Automatic resizing of uploaded images exceeding 2000 × 2000 pixels
- Published and unpublished image management
- Configurable image ordering
- Masonry image layout
- Load-more functionality
- Full-screen image viewer
- Django admin integration
- Reusable template tag
Requirements
- Python 3.10+
- Django 5.2, 6.0, or 6.1
- Pillow 10.0 or later
Installation
Install the package using pip:
pip install django-image-gallery
Configuration
Add django_image_gallery to your project's INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"django_image_gallery",
]
Run the database migrations:
python manage.py migrate
Usage
Load the template tag library and include the gallery wherever you want it displayed:
{% load django_image_gallery %}
{% gallery %}
The template tag retrieves all published gallery images and renders them using the package's included gallery template.
Media Configuration
Configure Django to handle uploaded media files:
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "media"
During local development, you can serve media files through Django by adding the following to your project's root urls.py:
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# Your URL patterns
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
For production deployments, configure your web server or storage backend to serve uploaded media files. Uploaded images must be accessible through the configured media storage.
Managing Images
Images can be added and managed through the Django admin interface.
After creating a superuser:
python manage.py createsuperuser
Log in to the admin interface and locate Gallery Images.
Each image supports the following fields:
| Field | Description |
|---|---|
| Title | Optional image title |
| Image | Uploaded image file |
| Caption | Optional image caption |
| Sort order | Controls the display order of images |
| Published | Determines whether the image appears in the gallery |
Only published images appear in the gallery. Images are ordered by sort_order, with newer entries taking precedence when sort orders match.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for django-image-gallery 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_image_gallery-0.1.0.tar.gz | 19.4 kB | Without provenance | Details for django_image_gallery-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_image_gallery-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for django_image_gallery-0.1.0-py3-none-any.whl |
Total release size: 41.1 kB
Release files / django_image_gallery-0.1.0.tar.gz
| Download URL | django_image_gallery-0.1.0.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20952e00687d657c49978039f623e3537cd57b94c472a037403333f6a6131f4c
|
|
BLAKE2b-256 checksum How to use checksums |
74bafe36f202574be0d33d5212417821e10b09ae70eecdc6e31379499c2157f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Release files / django_image_gallery-0.1.0-py3-none-any.whl
| Download URL | django_image_gallery-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a5cd41c0b4b3acdd57751688a56851a82c991175de4018b5ba196732fb75d90
|
|
BLAKE2b-256 checksum How to use checksums |
6ff20ad619235bd6cb38384504e3c60c7fe0e90c8beb9647ed1d29a4c63adf5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Security for django-image-gallery 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.