delete old cached map tiles
This commit is contained in:
parent
84b5c26f3d
commit
96dc678fe6
2 changed files with 20 additions and 1 deletions
17
src/c3nav/mapdata/tasks.py
Normal file
17
src/c3nav/mapdata/tasks.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import os
|
||||
from django.conf import settings
|
||||
|
||||
from c3nav.celery import app
|
||||
|
||||
|
||||
@app.task()
|
||||
def delete_old_cached_tiles(*args, **kwargs):
|
||||
from c3nav.mapdata.models import MapUpdate
|
||||
cache_key = MapUpdate.cache_key()
|
||||
|
||||
for folder in os.listdir(settings.TILES_ROOT):
|
||||
if folder == cache_key:
|
||||
continue
|
||||
fullpath = os.path.join(settings.TILES_ROOT, folder)
|
||||
if os.path.isdir(fullpath):
|
||||
os.system('rm -rf '+fullpath)
|
Loading…
Add table
Add a link
Reference in a new issue