This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
Nibasa Viewer is a lightweight, pure HTML+CSS gallery viewer designed for compatibility with older browsers. It uses Django as a backend framework but serves images directly from the filesystem rather than using database models.
**Key Design Principles:**
- Filesystem-first architecture (no image/folder models in database)
- No JavaScript or modern frontend frameworks
- Broad browser compatibility (uses HTML tables, not flexbox/grid)
- Dark theme optimized for image viewing
- Lazy thumbnail generation with on-disk caching
## Development Commands
```bash
# Install dependencies
pip install -r requirements.txt
# Run development server
python manage.py runserver
# Create user for gallery access (required)
python manage.py shell
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('<USERNAME>', '<EMAIL>', '<PASSWORD>')
>>> user.save()
>>> exit()
# Pre-generate all thumbnails (optional, done on-demand otherwise)
python manage.py makethumbnails
# Django admin commands
python manage.py migrate
python manage.py createsuperuser
python manage.py collectstatic
```
## Architecture
### Single App Structure
The project has one Django app: **`viewer`**. All gallery functionality is consolidated here:
-`views.py` - Gallery directory browsing and image viewing (viewer/views.py:65-189)
-`utils.py` - Thumbnail generation helpers
-`templates/` - Pure HTML templates (no JavaScript)
-`static/` - CSS styling and navigation icons
### Gallery Data Flow
**Filesystem as Data Source:**
- Images served from `GALLERY_ROOT` path (configured in `local_settings.py`)
- Thumbnails cached in `THUMBNAILS_ROOT` path
- No database models for images or directories
- Directory structure navigated using Python's `pathlib`
**Static File Routing:**
-`/imgs/` → Original images from `GALLERY_ROOT`
-`/thumbs/` → Cached thumbnails from `THUMBNAILS_ROOT`