La Sfera is a Django-based digital humanities application for analyzing and presenting manuscript variations of historical texts. The project is built for the Roy Rosenzweig Center for History and New Media.
- Backend: Django 5.0.2 with Python 3.11
- Database: PostgreSQL
- Frontend: Django templates with Tailwind CSS
- Content Management: Wagtail CMS
- Authentication: Django Allauth
- API: Django REST Framework
- Development Tools: Poetry for dependency management
The heart of the application, handling manuscript data and textual variants.
Key Models:
LineCode: Manages line numbering system (format: "BB.SS.LL")Library: Manuscript holding institutionsCodex: Individual manuscript recordsStanza: Text units with versioningStanzaTranslated: Translated versions of stanzasFolio: Manuscript page/folio informationSingleManuscript: Complete manuscript entitiesLocation: Geographic data for manuscript originsAuthorityFile: Controlled vocabulary management
Key Features:
- Line code validation and parsing
- Manuscript-to-manuscript variation tracking
- Multi-language support for translations
- Tify viewer integration for manuscript images
User authentication and account management using Django's built-in auth system extended with Allauth.
Image gallery functionality for manuscript images and other visual materials.
Wagtail-powered CMS pages for static content management.
Text annotation and markup functionality.
Tailwind CSS theme and static asset management.
settings.py: Main Django configuration
- PostgreSQL database configuration
- Wagtail CMS setup
- REST Framework configuration
- Tailwind CSS integration
- Authentication backends
- Media and static file handling
urls.py: URL routing configuration
- Admin interface routes
- API endpoints
- Wagtail CMS routes
- Application-specific URL includes
An auto-generated documentation for the database is hosted on dbdocs.io at: https://dbdocs.io/hepplerj/lasfera
Key Data Concepts:
- Line Codes: Hierarchical numbering system (Book.Stanza.Line format)
- Manuscript Variants: Tracks differences between manuscript versions
- Geographic Data: Location information with authority control
- Translation Management: Multiple language versions of texts
The application includes Django Import/Export functionality for data management, particularly useful for bulk manuscript data operations.
base.html: Main template with navigation and layoutindex.html: Homepage with image grid and project overviewmanuscripts.html: Manuscript browse and search interfacemanuscript_single.html: Individual manuscript detail viewstanzas.html: Text comparison and variant display- Wagtail templates for CMS pages
- Tailwind CSS for styling
- FontAwesome icons
- Custom JavaScript for interactive features
- Tify viewer for manuscript images
- Python 3.11 with Poetry for dependency management
- PostgreSQL database
- Node.js for Tailwind CSS compilation
- Environment variables in
.envfile
python manage.py runserver: Start development serverpython manage.py migrate: Apply database migrationspython manage.py collectstatic: Collect static filespython manage.py tailwind start: Start Tailwind CSS watcherpython manage.py createsuperuser: Create admin user
The manuscript/fixtures/ directory contains various JSON files for seeding the database with manuscript data.
It can be used with python manage.py loaddata, with a few steps to perform first.
First, after running migrations with python manage.py migrate, run flush to completely empty the database:
python manage.py flushThen, the "en" locale must be created for Wagtail:
python manage.py shellfrom wagtail.models import Locale
Locale.objects.get_or_create(language_code="en")Finally, run loaddata:
python manage.py loaddata manuscript/fixtures/all_data.json -v 3- Docker configuration available (
Dockerfile,docker-compose.yml) - Static file collection for production
- PostgreSQL database required
- Environment-specific settings via environment variables
- SECRET_KEY management via environment variables
- CSRF protection configured
- Authentication required for admin functions
- Proper static file handling
- Database indexing on key fields
- Static file optimization
- Tailwind CSS purging for production builds