apps.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. from django.apps import AppConfig
  2. class CoreConfig(AppConfig):
  3. name = 'core'
  4. def ready(self):
  5. print("-- Démarage du Core --")
  6. print(">> Vérification des variables d'environement")
  7. from core.models import Data
  8. print(">>> check site-name")
  9. try :
  10. data = Data.objects.get(d_titre_slugify = "site-name")
  11. except:
  12. data = Data()
  13. data.d_titre = "site-name"
  14. data.d_type = "txt"
  15. data.d_variable = "Duhaz Core"
  16. data.save()
  17. print(">>> check site-logo")
  18. try :
  19. data = Data.objects.get(d_titre_slugify = "site-logo")
  20. except:
  21. data = Data()
  22. data.d_titre = "site-logo"
  23. data.d_type = "txt"
  24. data.d_variable = "far fa-clone"
  25. data.save()
  26. print(">>> heck site-version")
  27. try :
  28. data = Data.objects.get(d_titre_slugify = "site-version")
  29. except :
  30. data = Data()
  31. data.d_titre = "site-version"
  32. data.d_type = "txt"
  33. data.d_variable = "Jan. 2024"
  34. data.save()
  35. print(">>> check background-color")
  36. try :
  37. data = Data.objects.get(d_titre_slugify = "background-color")
  38. except :
  39. data = Data()
  40. data.d_titre = "background-color"
  41. data.d_type = "txt"
  42. data.d_variable = "#999"
  43. data.save()
  44. print(">>> check background")
  45. try :
  46. data = Data.objects.get(d_titre_slugify = "background")
  47. except :
  48. data = Data()
  49. data.d_titre = "background"
  50. data.d_type = "txt"
  51. data.d_variable = "background.jpeg"
  52. data.save()
  53. print(">>> check background-logo")
  54. try :
  55. data = Data.objects.get(d_titre_slugify = "background-logo")
  56. except :
  57. data = Data()
  58. data.d_titre = "background-logo"
  59. data.d_type = "txt"
  60. data.d_variable = "logo-txt-Mrduhaz.png"
  61. data.save()
  62. print(">>> check login-menu")
  63. try :
  64. data = Data.objects.get(d_titre_slugify = "login-menu")
  65. except :
  66. data = Data()
  67. data.d_titre = "login-menu"
  68. data.d_type = "txt"
  69. data.d_variable = "True"
  70. data.save()
  71. print(">>> check includ-right-panel")
  72. try :
  73. data = Data.objects.get(d_titre_slugify = "includ-right-panel")
  74. except :
  75. data = Data()
  76. data.d_titre = "includ-right-panel"
  77. data.d_type = "txt"
  78. data.d_variable = "None"
  79. data.save()
  80. print(">>> check card-main-panel")
  81. try :
  82. data = Data.objects.get(d_titre_slugify = "card-main-panel")
  83. except :
  84. data = Data()
  85. data.d_titre = "card-main-panel"
  86. data.d_type = "txt"
  87. data.d_variable = "True"
  88. data.save()
  89. print(">>> check card-right-panel")
  90. try :
  91. data = Data.objects.get(d_titre_slugify = "card-right-panel")
  92. except :
  93. data = Data()
  94. data.d_titre = "card-right-panel"
  95. data.d_type = "txt"
  96. data.d_variable = "True"
  97. data.save()
  98. print(">> Vérification des pages par default")
  99. from core.models import Page
  100. print(">>> check bienvenus ")
  101. try :
  102. page = Page.objects.get(p_titre_slugify = "bienvenus")
  103. except :
  104. page = Page()
  105. page.p_titre = "Bienvenus"
  106. page.p_icone = "fas fa-home"
  107. page.p_contenu = "Bravo,</br>Ceci est votre 1er page."
  108. page.p_description = "Bravo, ceci est votre 1er page."
  109. page.p_adresse = "/"
  110. page.p_publier = True
  111. page.p_type = "sys"
  112. page.save()