keith-django-app-creator 0.5.0__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
app_creator/cli.py CHANGED
@@ -3,27 +3,35 @@ import sys
3
3
  import re
4
4
 
5
5
  def to_camel_case(value):
6
- # Remplace tous les séparateurs non alphanumériques par un espace
7
6
  value = re.sub(r'[^a-zA-Z0-9]', ' ', value)
8
- # Découpe par espace et capitalise chaque mot
9
7
  return ''.join(word.capitalize() for word in value.split())
10
8
 
11
9
  def create_app(app_name):
10
+ # Création des répertoires principaux
12
11
  os.makedirs(app_name, exist_ok=True)
13
12
  os.makedirs(f"{app_name}/models", exist_ok=True)
14
13
  os.makedirs(f"{app_name}/views", exist_ok=True)
15
14
  os.makedirs(f"{app_name}/migrations", exist_ok=True)
15
+ os.makedirs(f"{app_name}/templates/{app_name}", exist_ok=True)
16
+ os.makedirs(f"{app_name}/static/{app_name}", exist_ok=True)
16
17
 
17
- with open(f"{app_name}/__init__.py", "w"): pass
18
+ # Fichiers __init__.py
19
+ open(f"{app_name}/__init__.py", "w").close()
20
+ open(f"{app_name}/migrations/__init__.py", "w").close()
18
21
  with open(f"{app_name}/models/__init__.py", "w") as f:
19
22
  f.write("# models here\n")
20
-
21
23
  with open(f"{app_name}/views/__init__.py", "w") as f:
22
24
  f.write("# views here\n")
23
25
 
24
- with open(f"{app_name}/migrations/__init__.py", "w") as f:
25
- pass
26
+ # Fichier HTML template vide
27
+ with open(f"{app_name}/templates/{app_name}/my_template.html", "w") as f:
28
+ f.write("") # Fichier HTML vide
29
+
30
+ # Fichier CSS vide
31
+ with open(f"{app_name}/static/{app_name}/style.css", "w") as f:
32
+ f.write("") # Fichier CSS vide
26
33
 
34
+ # urls.py
27
35
  with open(f"{app_name}/urls.py", "w") as f:
28
36
  f.write(
29
37
  "from django.urls import path\n\n"
@@ -32,11 +40,13 @@ def create_app(app_name):
32
40
  "]\n"
33
41
  )
34
42
 
43
+ # admin.py
35
44
  with open(f"{app_name}/admin.py", "w") as f:
36
45
  f.write("from django.contrib import admin\n\n# Register your models here.\n")
37
46
 
47
+ # apps.py
48
+ class_name = to_camel_case(app_name) + "Config"
38
49
  with open(f"{app_name}/apps.py", "w") as f:
39
- class_name = to_camel_case(app_name) + "Config"
40
50
  f.write(
41
51
  "from django.apps import AppConfig\n\n"
42
52
  f"class {class_name}(AppConfig):\n"
@@ -44,10 +54,11 @@ def create_app(app_name):
44
54
  f" name = '{app_name}'\n"
45
55
  )
46
56
 
57
+ # tests.py
47
58
  with open(f"{app_name}/tests.py", "w") as f:
48
59
  f.write("from django.test import TestCase\n\n# Create your tests here.\n")
49
60
 
50
- print(f"App Django '{app_name}' créée avec succès !")
61
+ print(f"App Django '{app_name}' créée avec succès avec templates/ et static/.")
51
62
 
52
63
  def main():
53
64
  if len(sys.argv) < 2:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keith-django-app-creator
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Générateur de structure d'app Django personnalisée
5
5
  Author: Keith44
6
6
  Author-email: keitamohamed1432@gmail.com
@@ -1,5 +1,5 @@
1
1
  app_creator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- app_creator/cli.py,sha256=R2mn0bjEt1BmvDYt5CZ_DRsbg-e-JvWk4eVX2VjIohc,1923
2
+ app_creator/cli.py,sha256=u_V62qPiC5uzB5Jz-bgusiKQUjBP1OwuzJBqmnP-2iY,2346
3
3
  keita/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  keita/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
5
5
  keita/apps.py,sha256=9IvzXtmMUbnCJiQ7FqWh0D2ccMoRBtZQyOyDQBOSTpQ,141
@@ -11,8 +11,8 @@ keita/views/__init__.py,sha256=3IylRHwsJ1fBLYV0JXkaa8Ai4nAyRGfsFPFBodaHxes,13
11
11
  migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- keith_django_app_creator-0.5.0.dist-info/METADATA,sha256=xZmsBdQmz-bWtqknGRUEzi-kdiHeDhgzW2LvdsP4aHM,1296
15
- keith_django_app_creator-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- keith_django_app_creator-0.5.0.dist-info/entry_points.txt,sha256=dK2S_U_9kTbZWt-m1qw3JCdZrcsJbblg1krP8Ju5fRA,48
17
- keith_django_app_creator-0.5.0.dist-info/top_level.txt,sha256=fqkyUMAoXs-vdWHGewTkwBaCWwkn-eqmiwQZrpyty08,42
18
- keith_django_app_creator-0.5.0.dist-info/RECORD,,
14
+ keith_django_app_creator-0.6.0.dist-info/METADATA,sha256=4s3tXYoIenUFur0hWN6uVVnJLpbYo1wCOnD4zuGJXAQ,1296
15
+ keith_django_app_creator-0.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ keith_django_app_creator-0.6.0.dist-info/entry_points.txt,sha256=dK2S_U_9kTbZWt-m1qw3JCdZrcsJbblg1krP8Ju5fRA,48
17
+ keith_django_app_creator-0.6.0.dist-info/top_level.txt,sha256=fqkyUMAoXs-vdWHGewTkwBaCWwkn-eqmiwQZrpyty08,42
18
+ keith_django_app_creator-0.6.0.dist-info/RECORD,,