fix(imports): resolver rutas relativas de backend.app para linter y ejecucion dual

This commit is contained in:
2026-10-16 15:42:48 -03:00
parent 6b0d0bbc77
commit b2a4f878d8
2 changed files with 16 additions and 7 deletions
+12 -6
View File
@@ -10,13 +10,19 @@ import os
import sys
import json
# Agregar backend al sys.path
sys.path.append(os.path.abspath('backend'))
sys.path.append('/opt/admin-edu-space/backend')
# Asegurar backend en sys.path
backend_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'backend'))
if backend_dir not in sys.path:
sys.path.insert(0, backend_dir)
from app import create_app, db
from app.models.user import User
from app.models.role import Role
try:
from backend.app import create_app, db
from backend.app.models.user import User
from backend.app.models.role import Role
except ImportError:
from app import create_app, db
from app.models.user import User
from app.models.role import Role
def import_moodle_users(json_path: str = 'participantes_export.json') -> None: