From cbcbbc5277829b32eb7b4c40cfdec6b4d230495f Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Wed, 27 Sep 2023 18:07:24 -0500 Subject: [PATCH] Add chunk upload dir to settings --- dmoj/settings.py | 3 +++ judge/utils/fine_uploader.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dmoj/settings.py b/dmoj/settings.py index d5cfa38..e136a4d 100644 --- a/dmoj/settings.py +++ b/dmoj/settings.py @@ -485,6 +485,9 @@ META_REMOTE_ADDRESS_KEY = "REMOTE_ADDR" DEFAULT_AUTO_FIELD = "django.db.models.AutoField" +# Chunk upload +CHUNK_UPLOAD_DIR = "/tmp/chunk_upload_tmp" + try: with open(os.path.join(os.path.dirname(__file__), "local_settings.py")) as f: exec(f.read(), globals()) diff --git a/judge/utils/fine_uploader.py b/judge/utils/fine_uploader.py index a9909a7..2a22ccf 100644 --- a/judge/utils/fine_uploader.py +++ b/judge/utils/fine_uploader.py @@ -35,7 +35,7 @@ def save_upload(f, path): # pass callback function to post_upload def handle_upload(f, fileattrs, upload_dir, post_upload=None): - chunks_dir = os.path.join(tempfile.gettempdir(), "chunk_upload_tmp") + chunks_dir = settings.CHUNK_UPLOAD_DIR if not os.path.exists(os.path.dirname(chunks_dir)): os.makedirs(os.path.dirname(chunks_dir)) chunked = False