ohmyapi 0.1.15__py3-none-any.whl → 0.1.17__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.
- ohmyapi/core/scaffolding.py +4 -5
- {ohmyapi-0.1.15.dist-info → ohmyapi-0.1.17.dist-info}/METADATA +1 -1
- {ohmyapi-0.1.15.dist-info → ohmyapi-0.1.17.dist-info}/RECORD +5 -5
- {ohmyapi-0.1.15.dist-info → ohmyapi-0.1.17.dist-info}/WHEEL +0 -0
- {ohmyapi-0.1.15.dist-info → ohmyapi-0.1.17.dist-info}/entry_points.txt +0 -0
ohmyapi/core/scaffolding.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import os
|
2
1
|
from pathlib import Path
|
3
2
|
from jinja2 import Environment, FileSystemLoader
|
4
3
|
|
@@ -11,7 +10,7 @@ def render_template_file(template_path: Path, context: dict, output_path: Path):
|
|
11
10
|
"""Render a single Jinja2 template file to disk."""
|
12
11
|
template = env.get_template(str(template_path.relative_to(TEMPLATE_DIR)).replace("\\", "/"))
|
13
12
|
content = template.render(**context)
|
14
|
-
|
13
|
+
output_path.parent.mkdir(exist_ok=True)
|
15
14
|
with open(output_path, "w", encoding="utf-8") as f:
|
16
15
|
f.write(content)
|
17
16
|
|
@@ -22,7 +21,7 @@ def render_template_dir(template_subdir: str, target_dir: Path, context: dict, s
|
|
22
21
|
If subdir_name is given, files are placed inside target_dir/subdir_name.
|
23
22
|
"""
|
24
23
|
template_dir = TEMPLATE_DIR / template_subdir
|
25
|
-
for root, _, files in
|
24
|
+
for root, _, files in template_dir.walk():
|
26
25
|
root_path = Path(root)
|
27
26
|
rel_root = root_path.relative_to(template_dir) # path relative to template_subdir
|
28
27
|
|
@@ -45,7 +44,7 @@ def render_template_dir(template_subdir: str, target_dir: Path, context: dict, s
|
|
45
44
|
def startproject(name: str):
|
46
45
|
"""Create a new project: flat structure, all project templates go into <name>/"""
|
47
46
|
target_dir = Path(name).resolve()
|
48
|
-
|
47
|
+
target_dir.mkdir(exist_ok=True)
|
49
48
|
render_template_dir("project", target_dir, {"project_name": name})
|
50
49
|
print(f"✅ Project '{name}' created successfully.")
|
51
50
|
print(f"🔧 Next, configure your project in {target_dir / 'settings.py'}")
|
@@ -54,7 +53,7 @@ def startproject(name: str):
|
|
54
53
|
def startapp(name: str, project: str):
|
55
54
|
"""Create a new app inside a project: templates go into <project_dir>/<name>/"""
|
56
55
|
target_dir = Path(project)
|
57
|
-
|
56
|
+
target_dir.mkdir(exist_ok=True)
|
58
57
|
render_template_dir("app", target_dir, {"project_name": target_dir.resolve().name, "app_name": name}, subdir_name=name)
|
59
58
|
print(f"✅ App '{name}' created in project '{target_dir}' successfully.")
|
60
59
|
print(f"🔧 Remember to add '{name}' to your INSTALLED_APPS!")
|
@@ -7,7 +7,7 @@ ohmyapi/builtin/auth/routes.py,sha256=re3w7fZ9q9tUXDsQtkFcKizuEmtjxnebVA2lIO7afk
|
|
7
7
|
ohmyapi/cli.py,sha256=Mip1eBKYyu1hmUHbNW-1kSMc05EJOTVXqdI0c0r_B4g,4440
|
8
8
|
ohmyapi/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
ohmyapi/core/runtime.py,sha256=l5zffc4VTwQOo7G9mfiYHsPGapMONRX_jtO_z9QaKHU,8577
|
10
|
-
ohmyapi/core/scaffolding.py,sha256=
|
10
|
+
ohmyapi/core/scaffolding.py,sha256=Wf-cTC6l2iZETrIbLTT2l6lrNqgI67BSAO4V1nWQPhA,2539
|
11
11
|
ohmyapi/core/templates/app/__init__.py.j2,sha256=QwVIQVUGZVhdH1d4NrvL7NTsK4-T4cihzYs8UVX2dt4,43
|
12
12
|
ohmyapi/core/templates/app/models.py.j2,sha256=_3w-vFJ5fgsmncsCv34k_wyCMF78jufbSSglns4gbb0,119
|
13
13
|
ohmyapi/core/templates/app/routes.py.j2,sha256=MoaAgzTkbr0GbuEic_fKn0PkCLERK8bB-mDlssOxYzE,438
|
@@ -19,7 +19,7 @@ ohmyapi/db/exceptions.py,sha256=I7AubrdqQF_UvAvzKqz2ve08-BkXHzEWXnwG300StHE,35
|
|
19
19
|
ohmyapi/db/model/__init__.py,sha256=k3StTNuKatpwZo_Z5JBFa-927eJrzibFE8U4SA82asc,32
|
20
20
|
ohmyapi/db/model/model.py,sha256=BajFtLlQ1s0mZ2hj-_JNQhLQmxuVe-Lw2LuW5t2C7Rw,1579
|
21
21
|
ohmyapi/router.py,sha256=hutccsrP9RT8W5O6uBDhOJehwqrkRoPzaUI5zoHPh9A,55
|
22
|
-
ohmyapi-0.1.
|
23
|
-
ohmyapi-0.1.
|
24
|
-
ohmyapi-0.1.
|
25
|
-
ohmyapi-0.1.
|
22
|
+
ohmyapi-0.1.17.dist-info/METADATA,sha256=GfIo2FeVezZltV9W2vWlj3F-gqVvuyhy0X4tw0YmUjw,8766
|
23
|
+
ohmyapi-0.1.17.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
|
24
|
+
ohmyapi-0.1.17.dist-info/entry_points.txt,sha256=wb3lw8-meAlpiv1mqcQ3m25ukL7djagU_w89GkrC37k,43
|
25
|
+
ohmyapi-0.1.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|