Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 34 |
-
os.makedirs(UPLOAD_FOLDER)
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 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 |
|