Update upgrade.py

This commit is contained in:
Usman Nasir
2019-11-06 23:37:32 +05:00
committed by GitHub
parent c0413e045d
commit c3e3fa047b

View File

@@ -1359,6 +1359,12 @@ class Upgrade:
if items.find('SESSION_COOKIE_SECURE') > -1:
SESSION_COOKIE_SECURE = 0
DATABASE_ROUTERS = 1
for items in data:
if items.find('DATABASE_ROUTERS') > -1:
DATABASE_ROUTERS = 0
Upgrade.stdOut('Restoring settings file!')
writeToFile = open("/usr/local/CyberCP/CyberCP/settings.py", 'w')
@@ -1369,6 +1375,7 @@ class Upgrade:
writeToFile.writelines(" 'django.middleware.csrf.CsrfViewMiddleware',\n")
if items.find('DATABASE_ROUTERS') > -1:
writeToFile.writelines(items)
if SESSION_COOKIE_SECURE == 1:
con = """SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
@@ -1416,6 +1423,9 @@ CSRF_COOKIE_SECURE = True
writeToFile.writelines("MEDIA_URL = '/home/cyberpanel/media/'\n")
writeToFile.writelines('MEDIA_ROOT = MEDIA_URL\n')
if DATABASE_ROUTERS == 1:
writeToFile.writelines("DATABASE_ROUTERS = ['backup.backupRouter.backupRouter']\n")
writeToFile.close()
Upgrade.stdOut('Settings file restored!')