sikeaditya commited on
Commit
af610a2
·
verified ·
1 Parent(s): f4e536a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -30,13 +30,11 @@ app.secret_key = os.getenv("SECRET_KEY", "your-default-secret-key-for-flash-mess
30
  UPLOAD_FOLDER = 'static/uploads'
31
  ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
32
 
33
- if not os.path.exists(UPLOAD_FOLDER):
34
- os.makedirs(UPLOAD_FOLDER)
35
-
36
- # Configure audio folder (new)
37
- AUDIO_FOLDER = 'static/audio'
38
- if not os.path.exists(AUDIO_FOLDER):
39
- os.makedirs(AUDIO_FOLDER)
40
 
41
  app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
42
 
 
30
  UPLOAD_FOLDER = 'static/uploads'
31
  ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
32
 
33
+ try:
34
+ os.makedirs(UPLOAD_FOLDER, exist_ok=True)
35
+ os.makedirs(AUDIO_FOLDER, exist_ok=True)
36
+ except PermissionError as e:
37
+ raise RuntimeError(f"Failed to create required directories: {e}. Please check directory permissions!")
 
 
38
 
39
  app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
40