Package: papermerge-core
Papermerge REST API ServerThis python package is the heart of Papermerge project. It consists of a set
of reusable Django apps which are consumed across different bundles of
Papermerge Document Management System (DMS).Technically speaking, it contains following Django apps:papermerge.core- the epicenter of Papermerge DMS projectpapermerge.notifications- Django Channels app for sending notifications via websocketspapermerge.search- RESTful search. Supports four backends:Xapian,Whoosh,Elasticsearch,Solr.What is Papermerge?Papermerge is an open source document management system (DMS) primarily
designed for archiving and retrieving your digital documents. Instead of
having piles of paper documents all over your desk, office or drawers - you
can quickly scan them and configure your scanner to directly upload to
Papermerge DMS. Papermerge DMS on its turn will extract text data from the
scanned documents using Optical Character Recognition (OCR) technology the
index it and make it searchable. You will be able to quickly find any
(scanned!) document using full text search capabilities.Papermerge is perfect tool to manage documents in PDF, JPEG, TIFF and PNG formats.Features HighlightsOpenAPI compliant REST APIWorks well with PDF documentsOCR (Optical Character Recognition) of the documents (usesOCRmyPDF)Full Text Search of the scanned documents (supports four search engine backends, usesXapianby default)Document VersionsTags - assign colored tags to documents or foldersDocuments and Folders - users can organize documents in foldersMulti-User (supports user groups)User permissions managementPage Management - delete, reorder, cut & paste pages (usesPikePDF)DocumentationFor an overview on REST API is availablehere.Detailed online REST API reference can be viewed as:redocswaggerNote that REST API reference documentation is generated from
OpenAPI schema. OpenAPI schema is stored in its own dedicated
repositorypapermerge/openapi-schema.Papermerge DMS documentation is available athttps://docs.papermerge.ioDockerIn order to start Papermerge REST API server as docker image use following command:docker run -p 8000:8000 \
    -e PAPERMERGE__MAIN__SECRET_KEY=abc \
    -e DJANGO_SUPERUSER_PASSWORD=123 \
    papermerge/papermerge:latestIf you want initial superuser to have another username (e.g. john), useDJANGO_SUPERUSER_USERNAMEenvironment variable:docker run -p 8000:8000 \
    -e PAPERMERGE__MAIN__SECRET_KEY=abc \
    -e DJANGO_SUPERUSER_PASSWORD=123 \
    -e DJANGO_SUPERUSER_USERNAME=john \
    papermerge/papermerge:latestFor full list of supported environment variables checkonline documentation.Docker ComposeBy default Papermerge REST API server uses sqlite3 database. In order to use PostgreSQL use following docker compose file:version: '3.7'
services:
  app:
    image: papermerge/papermerge
    environment:
      - PAPERMERGE__MAIN__SECRET_KEY=abc
      - DJANGO_SUPERUSER_PASSWORD=12345
      - PAPERMERGE__DATABASE__TYPE=postgres
      - PAPERMERGE__DATABASE__USER=postgres
      - PAPERMERGE__DATABASE__PASSWORD=123
      - PAPERMERGE__DATABASE__NAME=postgres
      - PAPERMERGE__DATABASE__HOST=db
    ports:
      - 8000:8000
    depends_on:
      - db
  db:
    image: bitnami/postgresql:14.4.0
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    environment:
      - POSTGRES_PASSWORD=123
volumes:
    postgres_data:version: '3.7'Above mentioned docker compose file can be used to start Papermerge REST API server which will use PostgreSQL database to store data.For detailed description on how to start Papermerge DMS using docker compose readDocker Compose/Detailed Explanationsection in online docs.TestsTest suite is divided into two big groups:tests.coretests.searchFirst group is concerned with tests which do not depend on elasticsearch while
second onetests.searchis concerned with tests for whichdepend on elasticsearchand as result run very slow (hence the grouping). In
order to runtests.coretests you need to have redis up and running; in
order to runtest.searchyou need to bothredis and elasticsearchup and
running.Before running core tests suite, make sure redis service is up and running. Run tests:poetry run task test-coreBefore running search tests suite, make sure bothredis and elasticsearchservices are up and running:poetry run task test-searchIn order to run all tests suite (core + search):poetry run task testLintingUse following command to make sure that your code is formatted per PEP8 spec:poetry run task lint