Add chunk upload dir to settings

This commit is contained in:
cuom1999 2023-09-27 18:07:24 -05:00
parent c535ae4415
commit cbcbbc5277
2 changed files with 4 additions and 1 deletions

View file

@ -485,6 +485,9 @@ META_REMOTE_ADDRESS_KEY = "REMOTE_ADDR"
DEFAULT_AUTO_FIELD = "django.db.models.AutoField" DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
# Chunk upload
CHUNK_UPLOAD_DIR = "/tmp/chunk_upload_tmp"
try: try:
with open(os.path.join(os.path.dirname(__file__), "local_settings.py")) as f: with open(os.path.join(os.path.dirname(__file__), "local_settings.py")) as f:
exec(f.read(), globals()) exec(f.read(), globals())

View file

@ -35,7 +35,7 @@ def save_upload(f, path):
# pass callback function to post_upload # pass callback function to post_upload
def handle_upload(f, fileattrs, upload_dir, post_upload=None): 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)): if not os.path.exists(os.path.dirname(chunks_dir)):
os.makedirs(os.path.dirname(chunks_dir)) os.makedirs(os.path.dirname(chunks_dir))
chunked = False chunked = False