Skip to content

Commit 65618bb

Browse files
committed
WIP: serveradmin_extras setup
1 parent d82abea commit 65618bb

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

.docker/web/entrypoint.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33
source .env
44

5-
# Install or update dependencies on every start in case something changed
6-
uv sync
5+
# Install or update dependencies on every start in case something changed.
6+
# --inexact keeps packages that were added to the environment out-of-band (e.g.
7+
# an editable overlay installed via $SERVERADMIN_EXTRA_INSTALL below) instead of
8+
# pruning them.
9+
uv sync --inexact
10+
11+
# Optional local overlay: install an additional editable package (e.g. a private
12+
# bundle of serveradmin_* apps) into the same environment. Set via a git-ignored
13+
# docker-compose.override.yml so the open source setup is unaffected.
14+
if [ -n "$SERVERADMIN_EXTRA_INSTALL" ]; then
15+
echo "Installing extra package from $SERVERADMIN_EXTRA_INSTALL"
16+
uv pip install -e "$SERVERADMIN_EXTRA_INSTALL"
17+
fi
718

819
# Some users prefer to develop on their host rather than containers and have adjusted .env
920
if [ $POSTGRES_HOST == "localhost" ]; then

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ __pycache__/
4949
# The settings file
5050
/packages/serveradmin/serveradmin/local_settings.py
5151

52+
# Local docker-compose overlay (e.g. to mount/install a private app bundle)
53+
/docker-compose.override.yml
54+

packages/serveradmin/serveradmin/settings.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@
7575
'compressor',
7676
]
7777

78+
# Automatically register optional serveradmin_* Django apps that happen to be
79+
# installed in the environment (for example the private serveradmin-extras
80+
# bundle). This follows the same naming convention already used to auto-wire
81+
# their URLs in urls.py and their servershell plugins in servershell/utils.py,
82+
# so simply installing such a package is enough to activate it - no manual
83+
# INSTALLED_APPS editing required. Open source setups without any such package
84+
# installed are unaffected.
85+
import pkgutil
86+
87+
INSTALLED_APPS += sorted(
88+
name
89+
for _, name, is_package in pkgutil.iter_modules()
90+
if is_package
91+
and name.startswith('serveradmin_')
92+
and name not in INSTALLED_APPS
93+
)
94+
7895
MENU_TEMPLATES = [
7996
'servershell/menu.html',
8097
'resources/menu.html',

0 commit comments

Comments
 (0)