Changing location of /tmp/seahub_cache

Hi,

I would like to change the caching directory from
‘/tmp/seahub_cache’ to ‘$HOME/logs/seahub_cache’.

The caching location is defined inside the program area
$HOME/seafile-server-latest/seahub/seahub/settings.py
CACHE_DIR = “/tmp”

I tried to overwrite this location by overwrite the variable
inside $HOME/conf/seahub_settings.py
CACHE_DIR = “/data/seafile/haiwen/logs”

but it does not work. It’s still in /tmp

Maybe somebody can give me a small hint how to change the location
of the seahub caching directory?

Best regards
Daniel

try add the following setting to seahub_settings.py (below the sentence of CACHE_DIR = "/data/seafile/haiwen/logs")

import os
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        'LOCATION': os.path.join(CACHE_DIR, 'seahub_cache'),
        'OPTIONS': {
            'MAX_ENTRIES': 1000000
        }
    }
}

Hallo Lian,

cool, after adding

 CACHE_DIR = os.environ.get('SEAHUB_LOG_DIR', '/tmp')

before the definition “CACHES = { …”, the cache location
changed now to …/haiwen/logs/seahub_cache

Great. Thanks very much!

regards
Daniel

Hi

Could I ask how the actual final seahub_settings.py file looked like in the end.

I think I have the same problem to solve (to move the default location of /tmp) but I can’t get it to work.

Would be very much appreciated :wink:

Cheers, Chris

2 Likes

same problem.
PermissionError: [Errno 13] Permission denied: '/tmp/seahub_cache/ceec40422771f78d283f254429d1d993.djcac

HOw i can set permisison or move tmp folder?

First of all, I doubt that this is the same problem. You reopened a post from mid-2017. Sooo many things have changed since then!

https://help.ubuntu.com/community/FilePermissions

Soluction to my problem: I set 777 permisison to temp folder on root and solved