diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c5b5d291e..402ab2242 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,9 @@
-
+
+
+
diff --git a/CyberCP/settings.py b/CyberCP/settings.py
index c293342f9..73480c575 100644
--- a/CyberCP/settings.py
+++ b/CyberCP/settings.py
@@ -36,36 +36,48 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
- 'baseTemplate',
+
+ # Core apps (no dependencies on other custom apps)
+ 'loginSystem', # Base app - many apps depend on Administrator model
+ 'packages', # websiteFunctions depends on this
+
+ # Apps with single dependency
+ 'websiteFunctions', # Depends on packages and loginSystem
+ 'baseTemplate', # Depends on loginSystem
+ 'userManagment', # Depends on loginSystem
+ 'dns', # Depends on loginSystem
+
+ # Apps depending on websiteFunctions
+ 'databases', # Depends on websiteFunctions
+ 'ftp', # Depends on websiteFunctions
+ 'filemanager', # Depends on websiteFunctions
+ 'mailServer', # Depends on websiteFunctions, ChildDomains
+
+ # Apps with multiple or complex dependencies
+ 'emailPremium', # Depends on mailServer
+ 'emailMarketing', # Depends on websiteFunctions and loginSystem
+ 'cloudAPI', # Depends on websiteFunctions
+ 'containerization', # Depends on websiteFunctions
+ 'IncBackups', # Depends on websiteFunctions and loginSystem
+ 'CLManager', # Depends on packages
+
+ # Apps with dependencies on loginSystem only
+ 's3Backups', # Depends on loginSystem
+ 'dockerManager', # Depends on loginSystem
+ 'aiScanner', # Depends on loginSystem
+
+ # Independent apps (no model dependencies found)
'firewall',
- 'loginSystem',
- 'packages',
- 'websiteFunctions',
'tuning',
'serverStatus',
- 'dns',
- 'ftp',
- 'userManagment',
- 'databases',
- 'mailServer',
'serverLogs',
'backup',
'managePHP',
'manageSSL',
'api',
- 'filemanager',
'manageServices',
'pluginHolder',
- 'emailPremium',
- 'emailMarketing',
- 'cloudAPI',
'highAvailability',
- 's3Backups',
- 'dockerManager',
- 'containerization',
- 'CLManager',
- 'IncBackups',
- 'aiScanner',
# 'WebTerminal'
]
diff --git a/install/install.py b/install/install.py
index 6db4da790..25674ea95 100644
--- a/install/install.py
+++ b/install/install.py
@@ -2149,15 +2149,15 @@ password="%s"
# Clean any existing migration files first (except __init__.py and excluding virtual environment)
logging.InstallLog.writeToFile("Cleaning existing migration files...")
# Only delete migration files from app directories, not from lib/lib64/bin directories
- command = "find /usr/local/CyberCP -type f -path '*/migrations/0*.py' ! -path '*/lib/*' ! -path '*/lib64/*' ! -path '*/bin/*' -delete 2>/dev/null || true"
+ command = "bash -c \"find /usr/local/CyberCP -type f -path '*/migrations/0*.py' ! -path '*/lib/*' ! -path '*/lib64/*' ! -path '*/bin/*' -delete 2>/dev/null || true\""
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# Clean any existing migration pyc files (excluding virtual environment)
- command = "find /usr/local/CyberCP -type f -path '*/migrations/*.pyc' ! -path '*/lib/*' ! -path '*/lib64/*' ! -path '*/bin/*' -delete 2>/dev/null || true"
+ command = "bash -c \"find /usr/local/CyberCP -type f -path '*/migrations/*.pyc' ! -path '*/lib/*' ! -path '*/lib64/*' ! -path '*/bin/*' -delete 2>/dev/null || true\""
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# Clean __pycache__ directories in migrations folders (excluding virtual environment)
- command = "find /usr/local/CyberCP -type d -path '*/migrations/__pycache__' ! -path '*/lib/*' ! -path '*/lib64/*' ! -path '*/bin/*' -exec rm -rf {} + 2>/dev/null || true"
+ command = "bash -c \"find /usr/local/CyberCP -type d -path '*/migrations/__pycache__' ! -path '*/lib/*' ! -path '*/lib64/*' ! -path '*/bin/*' -exec rm -rf {} + 2>/dev/null || true\""
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# Fix baseTemplate migrations - ensure required migration files exist
@@ -2190,8 +2190,13 @@ password="%s"
preFlightsChecks.stdOut("ERROR: No Python virtual environment found!", 0)
return False
- # Create all migrations at once - Django will handle dependencies
- logging.InstallLog.writeToFile("Creating fresh migrations for all apps...")
+ # Create migrations in dependency order - loginSystem first since other apps depend on it
+ logging.InstallLog.writeToFile("Creating migrations for loginSystem first...")
+ command = f"{python_path} manage.py makemigrations loginSystem --noinput"
+ preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
+
+ # Now create migrations for all other apps
+ logging.InstallLog.writeToFile("Creating migrations for all other apps...")
command = f"{python_path} manage.py makemigrations --noinput"
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)