A local Django-based Document Management System with OCR, department-level access control, document organization, and search.
dms_project/: Django project configurationaccounts/: custom user model, company/department/unit structure, authenticationdocuments/: document model, OCR processing, search and management viewstemplates/: Django templates for dashboard, upload, list, detail, editmedia/: local file storage for uploaded documentsDockerfile/docker-compose.yml: containers for local development
- Login/logout with role-based access (Admin, Manager, Staff)
- Company / Department / Unit hierarchy
- Document upload for PDF/image files with OCR
- OCR text extraction and metadata suggestions
- Folder-style storage under
media/storage/{department}/{year}/{document_type}/ - Document search by title, tags, OCR content, department, and date
- Archive browsing by department, year, and document type
- Basic API endpoints for document listing and detail
- Secure file handling with department-level document access
-
Create and activate a virtual environment:
python -m venv .venv .venv\Scripts\activate
-
Install requirements:
pip install -r requirements.txt
-
Install system dependencies on Linux:
sudo apt-get update sudo apt-get install -y tesseract-ocr poppler-utils
-
Configure PostgreSQL and environment variables in
dms_project/settings.pyor via environment. PostgreSQL is the production database and should be used for deployment:POSTGRES_DBPOSTGRES_USERPOSTGRES_PASSWORDPOSTGRES_HOSTPOSTGRES_PORT
For local development only, you may optionally set
DJANGO_USE_SQLITE=True. -
Run migrations and create a superuser:
python manage.py migrate python manage.py createsuperuser
-
Start the development server:
python manage.py runserver
-
Open
http://127.0.0.1:8000/in your browser.
docker compose up --buildThe web app will be available at http://127.0.0.1:8000.
Create a local .env file from .env.example and set production values.
Start the production stack with:
docker compose -f docker-compose.prod.yml up --buildThen browse to http://localhost.
This setup uses:
- PostgreSQL as the production database
- Gunicorn as the application server
- Nginx as a reverse proxy
media/for uploaded files
- Use Django admin to create companies, departments, units, and roles.
- Uploaded documents are stored in
media/storage/. - OCR is powered by Tesseract and uses
pdf2imagefor PDF rendering. - The app is designed to be deployable behind Nginx later.