skrift 0.1.0a5__py3-none-any.whl → 0.1.0a7__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.
- skrift/asgi.py +23 -14
- {skrift-0.1.0a5.dist-info → skrift-0.1.0a7.dist-info}/METADATA +1 -1
- {skrift-0.1.0a5.dist-info → skrift-0.1.0a7.dist-info}/RECORD +5 -5
- {skrift-0.1.0a5.dist-info → skrift-0.1.0a7.dist-info}/WHEEL +0 -0
- {skrift-0.1.0a5.dist-info → skrift-0.1.0a7.dist-info}/entry_points.txt +0 -0
skrift/asgi.py
CHANGED
|
@@ -10,6 +10,8 @@ The application uses a dispatcher architecture:
|
|
|
10
10
|
import asyncio
|
|
11
11
|
import hashlib
|
|
12
12
|
import importlib
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
13
15
|
from datetime import datetime
|
|
14
16
|
from pathlib import Path
|
|
15
17
|
|
|
@@ -56,16 +58,17 @@ def load_controllers() -> list:
|
|
|
56
58
|
if not config:
|
|
57
59
|
return []
|
|
58
60
|
|
|
61
|
+
# Add working directory to sys.path for local controller imports
|
|
62
|
+
cwd = os.getcwd()
|
|
63
|
+
if cwd not in sys.path:
|
|
64
|
+
sys.path.insert(0, cwd)
|
|
65
|
+
|
|
59
66
|
controllers = []
|
|
60
67
|
for controller_spec in config.get("controllers", []):
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
controllers.append(controller_class)
|
|
66
|
-
except Exception:
|
|
67
|
-
# Skip controllers that can't be loaded during setup
|
|
68
|
-
pass
|
|
68
|
+
module_path, class_name = controller_spec.split(":")
|
|
69
|
+
module = importlib.import_module(module_path)
|
|
70
|
+
controller_class = getattr(module, class_name)
|
|
71
|
+
controllers.append(controller_class)
|
|
69
72
|
|
|
70
73
|
return controllers
|
|
71
74
|
|
|
@@ -309,9 +312,11 @@ def create_app() -> Litestar:
|
|
|
309
312
|
)
|
|
310
313
|
|
|
311
314
|
# Template configuration
|
|
315
|
+
# Search working directory first for user overrides, then package directory
|
|
316
|
+
working_dir_templates = Path(os.getcwd()) / "templates"
|
|
312
317
|
template_dir = Path(__file__).parent / "templates"
|
|
313
318
|
template_config = TemplateConfig(
|
|
314
|
-
directory=template_dir,
|
|
319
|
+
directory=[working_dir_templates, template_dir],
|
|
315
320
|
engine=JinjaTemplateEngine,
|
|
316
321
|
engine_callback=lambda engine: engine.engine.globals.update({
|
|
317
322
|
"now": datetime.now,
|
|
@@ -322,10 +327,11 @@ def create_app() -> Litestar:
|
|
|
322
327
|
}),
|
|
323
328
|
)
|
|
324
329
|
|
|
325
|
-
# Static files
|
|
330
|
+
# Static files - working directory first for user overrides, then package directory
|
|
331
|
+
working_dir_static = Path(os.getcwd()) / "static"
|
|
326
332
|
static_files_router = create_static_files_router(
|
|
327
333
|
path="/static",
|
|
328
|
-
directories=[Path(__file__).parent / "static"],
|
|
334
|
+
directories=[working_dir_static, Path(__file__).parent / "static"],
|
|
329
335
|
)
|
|
330
336
|
|
|
331
337
|
from skrift.auth import sync_roles_to_database
|
|
@@ -381,9 +387,11 @@ def create_setup_app() -> Litestar:
|
|
|
381
387
|
)
|
|
382
388
|
|
|
383
389
|
# Template configuration
|
|
390
|
+
# Search working directory first for user overrides, then package directory
|
|
391
|
+
working_dir_templates = Path(os.getcwd()) / "templates"
|
|
384
392
|
template_dir = Path(__file__).parent / "templates"
|
|
385
393
|
template_config = TemplateConfig(
|
|
386
|
-
directory=template_dir,
|
|
394
|
+
directory=[working_dir_templates, template_dir],
|
|
387
395
|
engine=JinjaTemplateEngine,
|
|
388
396
|
engine_callback=lambda engine: engine.engine.globals.update({
|
|
389
397
|
"now": datetime.now,
|
|
@@ -394,10 +402,11 @@ def create_setup_app() -> Litestar:
|
|
|
394
402
|
}),
|
|
395
403
|
)
|
|
396
404
|
|
|
397
|
-
# Static files
|
|
405
|
+
# Static files - working directory first for user overrides, then package directory
|
|
406
|
+
working_dir_static = Path(os.getcwd()) / "static"
|
|
398
407
|
static_files_router = create_static_files_router(
|
|
399
408
|
path="/static",
|
|
400
|
-
directories=[Path(__file__).parent / "static"],
|
|
409
|
+
directories=[working_dir_static, Path(__file__).parent / "static"],
|
|
401
410
|
)
|
|
402
411
|
|
|
403
412
|
# Import controllers
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
skrift/__init__.py,sha256=eXE5PFVkJpH5XsV_ZlrTIeFPUPrmcHYAj4GpRS3R5PY,29
|
|
2
2
|
skrift/__main__.py,sha256=wt6JZL9nBhKU36vdyurhOEtWy7w3C9zohyy24PLcKho,164
|
|
3
3
|
skrift/alembic.ini,sha256=mYguI6CbMCTyfHctsGiTyf9Z5gv21FdeI3qtfgOHO3A,1815
|
|
4
|
-
skrift/asgi.py,sha256=
|
|
4
|
+
skrift/asgi.py,sha256=Y4cOH4bgGaRcDZiXgNH0DAnWurFQGsOgYqtNwHYDGTI,19900
|
|
5
5
|
skrift/cli.py,sha256=aT-7pXvOuuZC-Eypx1h-xCiqaBKhIFjSqd5Ky_dHna0,4214
|
|
6
6
|
skrift/config.py,sha256=_fXfdRdy03yJWUhijthC4cNgOXLJ0jhB__C-VwVYaxc,7398
|
|
7
7
|
skrift/admin/__init__.py,sha256=x81Cj_ilVmv6slaMl16HHyT_AgrnLxKEWkS0RPa4V9s,289
|
|
@@ -66,7 +66,7 @@ skrift/templates/setup/configuring.html,sha256=2KHW9h2BrJgL_kO5IizbAYs4pnFLyRf76
|
|
|
66
66
|
skrift/templates/setup/database.html,sha256=gU4-315-QraHa2Eq4Fh3b55QpOM2CkJzh27_Yz13frA,5495
|
|
67
67
|
skrift/templates/setup/restart.html,sha256=GHg31F_e2uLFhWUzJoalk0Y0oYLqsFWyZXWKX3mblbY,1355
|
|
68
68
|
skrift/templates/setup/site.html,sha256=PSOH-q1-ZBl47iSW9-Ad6lEfJn_fzdGD3Pk4vb3xgK4,1680
|
|
69
|
-
skrift-0.1.
|
|
70
|
-
skrift-0.1.
|
|
71
|
-
skrift-0.1.
|
|
72
|
-
skrift-0.1.
|
|
69
|
+
skrift-0.1.0a7.dist-info/METADATA,sha256=mTu2DH5_wI0epJniULyf2Txwp7I_MzwoKCukUASlUwg,6435
|
|
70
|
+
skrift-0.1.0a7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
71
|
+
skrift-0.1.0a7.dist-info/entry_points.txt,sha256=uquZ5Mumqr0xwYTpTcNiJtFSITGfF6_QCCy2DZJSZig,42
|
|
72
|
+
skrift-0.1.0a7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|