Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -811,6 +811,24 @@ def monitor_and_restart_files():
|
|
| 811 |
except Exception as e:
|
| 812 |
logger.error(f"❌ خطأ في المراقبة: {e}")
|
| 813 |
time.sleep(10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 814 |
if __name__ == '__main__':
|
| 815 |
logger.info("🚀 Starting Flask application...")
|
| 816 |
logger.info(f"📦 Essential Modules Available: {essential_modules_available}")
|
|
|
|
| 811 |
except Exception as e:
|
| 812 |
logger.error(f"❌ خطأ في المراقبة: {e}")
|
| 813 |
time.sleep(10)
|
| 814 |
+
import os
|
| 815 |
+
import subprocess
|
| 816 |
+
|
| 817 |
+
def run_all_python_files():
|
| 818 |
+
# الحصول على مسار المجلد الحالي
|
| 819 |
+
current_directory = os.getcwd()
|
| 820 |
+
|
| 821 |
+
# البحث عن جميع ملفات بايثون في المجلد
|
| 822 |
+
for filename in os.listdir(current_directory):
|
| 823 |
+
if filename.endswith('.py'):
|
| 824 |
+
# بناء المسار الكامل للملف
|
| 825 |
+
file_path = os.path.join(current_directory, filename)
|
| 826 |
+
print(f'تشغيل: {file_path}')
|
| 827 |
+
# تشغيل الملف
|
| 828 |
+
subprocess.run(['python', file_path])
|
| 829 |
+
|
| 830 |
+
# استدعاء الدالة
|
| 831 |
+
run_all_python_files()
|
| 832 |
if __name__ == '__main__':
|
| 833 |
logger.info("🚀 Starting Flask application...")
|
| 834 |
logger.info(f"📦 Essential Modules Available: {essential_modules_available}")
|