Version 4.0.2

Released: May 25, 2021

Status: Stable



Some API endpoints that used parent-child resources were not working correctly on some use cases when using token authentication, returning error 404 for valid requests. The API views now ensure that authentication has completed before doing initial filtering on the parent resource.

The Django REST framework version was updated from version 3.11.0 to 3.11.2.


A solution for the longstanding issue of cabinet sorting was found. Cabinets are a nested model and cannot be sorted properly with Django’s queryset sorting methods. Native tree sorting was implemented. This requires a rebuild of the existing cabinet tree which is accomplished by an included migration.

The django-mptt library was updated from version 0.11.0 to 0.12.0.


PIP was updated from version 21.0.1 to 21.1.1.


Several typos in the documentation were fixed. More context was added to some upgrade steps.


Support for marking messages as unread was added.

Opening a message will now mark it as read automatically.

User interface

The action dropdown template partial was moved to the navigation app.

Some unused and deprecated markup was removed.

The appearance of disabled action links was fixed.


  • Minor source string fixes.


  • None

Upgrade process

Docker Compose

Check the Docker upgrading chapter for the complete upgrade process.

Direct deployment

Upgrading from Mayan EDMS 3.5.x


Supervisord must be upgraded to version 4.2.2. See troubleshooting section: After upgrade to version 4.1

  1. Stop supervisord:

    sudo systemctl stop supervisor
  2. Make a backup of your supervisord file:

    sudo cp /etc/supervisor/conf.d/mayan-edms.conf /etc/supervisor/conf.d/mayan-edms.conf.bck
  3. Make a backup of your database:

    Use the respective backup command for the database:

  4. Upgrade to the latest pip version:

    sudo --user=mayan /opt/mayan-edms/bin/pip install --upgrade pip
  5. Remove deprecated requirements:

    sudo --user=mayan curl --output /tmp/removals.txt \
    && sudo --user=mayan /opt/mayan-edms/bin/pip uninstall --requirement /tmp/removals.txt --yes
  6. Update the Mayan EDMS Python package:

    sudo --user=mayan /opt/mayan-edms/bin/pip install mayan-edms==4.4.5

    the requirements will also be updated automatically.

  7. Update the Redis configuration to serve at least 3 databases:


    databases ...


    databases 3
  8. Restart Redis for the changes to take effect:

    sudo systemctl restart redis
  9. Edit the config file at /opt/mayan-edms/media/config.yml:




    LOCK_MANAGER_BACKEND: mayan.apps.lock_manager.backends.redis_lock.RedisLock
    LOCK_MANAGER_BACKEND_ARGUMENTS: {'redis_url':'redis://:mayanredispassword@<IP address of Redis server>:6379/2'}
  10. Update the supervisord configuration file. Replace the environment variables values shown here with your respective settings. This step will refresh the supervisord configuration file with the new queues and the latest recommended layout:

    sudo --user=mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media/ \
    /opt/mayan-edms/bin/ platformtemplate supervisord | sudo sh -c "cat > /etc/supervisor/conf.d/mayan-edms.conf"
  11. Edit the supervisord configuration file and update any setting specific to your installation:

    sudo vi /etc/supervisor/conf.d/mayan-edms.conf
  12. Migrate existing database schema and static media files with:

    sudo --user=mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media/ \
    /opt/mayan-edms/bin/ performupgrade
  13. Start supervisord:

    sudo systemctl start supervisor
  14. Clear the browser cache to avoid loading old web assets.

The upgrade procedure is now complete.


If you observe the errors:

  • mayan.apps.file_caching.models.CachePartitionFile.DoesNotExist: CachePartitionFile matching query does not exist.


  • FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/mayan/document_file_storage/...

follow the solution outlined in the troubleshooting section: After upgrade to version 4.0

Backward incompatible changes

  • None

Issues closed

  • GitLab issue #981 4.0, version export and messages app

  • GitLab issue #984 Documentation: “Upgrade process 7.Create the user_settings folder inside the media folder”

  • GitLab issue #986 Cabinets are listed in order of creation in drop-down, but in alphabetical order in cabinet view