fix error when trying to re-create media folder

This commit is contained in:
James Ravenscroft 2021-12-24 10:50:40 +00:00
parent e7ae240555
commit c7ea1bc1c8
1 changed files with 2 additions and 1 deletions

View File

@ -118,6 +118,7 @@ def req():
photo_url = os.path.join(os.environ.get('MICROPUB_MEDIA_URL_PREFIX'), now.strftime("%Y/%m/%d"), str(now_ts) + ".jpg") photo_url = os.path.join(os.environ.get('MICROPUB_MEDIA_URL_PREFIX'), now.strftime("%Y/%m/%d"), str(now_ts) + ".jpg")
# make directory if needed # make directory if needed
if not os.path.exists(os.path.dirname(filename)):
os.makedirs(os.path.dirname(filename)) os.makedirs(os.path.dirname(filename))
with open(filename, 'wb') as f: with open(filename, 'wb') as f: