image stuff

This commit is contained in:
Bryan Gerlach
2024-10-08 14:09:44 -05:00
parent e9af4e61e8
commit 9034535cc6
2 changed files with 3 additions and 3 deletions

View File

@@ -29,7 +29,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = True
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']

View File

@@ -309,9 +309,9 @@ def startgh(request):
return HttpResponse('') return HttpResponse('')
def save_png(file, uuid, domain): def save_png(file, uuid, domain):
file_save_path = "png/%s/%s" % uuid, file.name file_save_path = "png/%s/%s" % (uuid, file.name)
Path("png/%s" % uuid).mkdir(parents=True, exist_ok=True) Path("png/%s" % uuid).mkdir(parents=True, exist_ok=True)
with open(file_save_path, "wb+") as f: with open(file_save_path, "wb+") as f:
for chunk in file.chunks(): for chunk in file.chunks():
f.write(chunk) f.write(chunk)
return "%s/%s" % domain, file_save_path return "%s/%s" % (domain, file_save_path)