Skip to content

Commit 24610bb

Browse files
authored
Auto-reload changes to html and python in development mode (#1378)
1 parent f944a46 commit 24610bb

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

cps/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
REMEMBER_COOKIE_SAMESITE='Strict',
8181
WTF_CSRF_SSL_STRICT=False,
8282
SESSION_COOKIE_NAME=os.environ.get('COOKIE_PREFIX', "") + "session",
83-
REMEMBER_COOKIE_NAME=os.environ.get('COOKIE_PREFIX', "") + "remember_token"
83+
REMEMBER_COOKIE_NAME=os.environ.get('COOKIE_PREFIX', "") + "remember_token",
84+
TEMPLATES_AUTO_RELOAD=os.environ.get('DEVELOP_ON', 'False').lower() == 'true',
8485
)
8586

8687
# Fix for running behind reverse proxy (e.g. nginx, apache, caddy, ...)

docker-compose.yml.dev

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ services:
2222
# Skip the automatic library detection/mount at startup. When enabled, the auto-library service will not run.
2323
# Accepts: true/yes/1 to disable auto-mount (default: false)
2424
# - DISABLE_LIBRARY_AUTOMOUNT=false
25+
# DEV SPECIFIC
26+
### Set DEBUG_ON to true to:
27+
### 1. Have Flask/Jinja2 auto-reload templates on each request (no restart needed)
28+
### 2. Watch cps/ for .py changes and auto-restart the server when any Python file changes
29+
### Requres dev specific binds to be set.
30+
- DEVELOP_ON=true
2531
volumes:
2632
# CW users migrating should stop their existing CW instance, make a copy of the config folder, and bind that here to carry over all of their user settings ect.
2733
- /path/to/config/folder:/config
@@ -38,11 +44,12 @@ services:
3844
### This will let you see your changes in realtime, test ect. You can use build.sh to prepare images with your changes.
3945
### For example:
4046
# /your/dev/env/cps:/app/calibre-web-automated/cps
47+
# /your/dev/env/scripts:/app/calibre-web-automated/scripts
4148

4249
ports:
4350
# Change the first number to change the port you want to access the Web UI, not the second
4451
- 8083:8083
4552
# If you set CWA_PORT_OVERRIDE to a port below 1024, you may need to uncomment the following line:
4653
# cap_add:
4754
# - NET_BIND_SERVICE
48-
restart: unless-stopped
55+
restart: unless-stopped

0 commit comments

Comments
 (0)