keith-django-app-creator 0.5.0__tar.gz → 0.6.0__tar.gz
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.
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/PKG-INFO +1 -1
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/app_creator/cli.py +19 -8
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keith_django_app_creator.egg-info/PKG-INFO +1 -1
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/setup.py +1 -1
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/README.md +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/app_creator/__init__.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/__init__.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/admin.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/apps.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/migrations/__init__.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/models/__init__.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/tests.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/urls.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/views/__init__.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keith_django_app_creator.egg-info/SOURCES.txt +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keith_django_app_creator.egg-info/dependency_links.txt +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keith_django_app_creator.egg-info/entry_points.txt +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keith_django_app_creator.egg-info/top_level.txt +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/migrations/__init__.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/models/__init__.py +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/setup.cfg +0 -0
- {keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/views/__init__.py +0 -0
@@ -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
|
-
|
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
|
-
|
25
|
-
|
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:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{keith_django_app_creator-0.5.0 → keith_django_app_creator-0.6.0}/keita/migrations/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|