Auto-reload static assets in development
This commit is contained in:
parent
bbd736e915
commit
3191f1fe3b
2 changed files with 4 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ worker_class = "gthread"
|
||||||
workers = 1
|
workers = 1
|
||||||
threads = 4
|
threads = 4
|
||||||
reload = True
|
reload = True
|
||||||
|
raw_env = ["SOULSYNC_WEB_DEV_NO_CACHE=1"]
|
||||||
|
|
||||||
# Keep requests from hanging forever on slow external services.
|
# Keep requests from hanging forever on slow external services.
|
||||||
timeout = 120
|
timeout = 120
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ from core.automation_engine import AutomationEngine
|
||||||
# --- Flask App Setup ---
|
# --- Flask App Setup ---
|
||||||
base_dir = os.path.abspath(os.path.dirname(__file__))
|
base_dir = os.path.abspath(os.path.dirname(__file__))
|
||||||
project_root = os.path.dirname(base_dir) # Go up one level to the project root
|
project_root = os.path.dirname(base_dir) # Go up one level to the project root
|
||||||
|
DEV_STATIC_NO_CACHE = os.environ.get('SOULSYNC_WEB_DEV_NO_CACHE', '0').lower() in ('1', 'true', 'yes', 'on')
|
||||||
|
|
||||||
# Check for environment variable first (Docker support), then fallback to calculated path
|
# Check for environment variable first (Docker support), then fallback to calculated path
|
||||||
env_config_path = os.environ.get('SOULSYNC_CONFIG_PATH')
|
env_config_path = os.environ.get('SOULSYNC_CONFIG_PATH')
|
||||||
|
|
@ -158,6 +159,8 @@ app = Flask(
|
||||||
template_folder=os.path.join(base_dir, 'webui'),
|
template_folder=os.path.join(base_dir, 'webui'),
|
||||||
static_folder=os.path.join(base_dir, 'webui', 'static')
|
static_folder=os.path.join(base_dir, 'webui', 'static')
|
||||||
)
|
)
|
||||||
|
app.config['TEMPLATES_AUTO_RELOAD'] = DEV_STATIC_NO_CACHE
|
||||||
|
app.jinja_env.auto_reload = DEV_STATIC_NO_CACHE
|
||||||
|
|
||||||
# --- Flask Session Setup (for multi-profile support) ---
|
# --- Flask Session Setup (for multi-profile support) ---
|
||||||
import secrets as _secrets
|
import secrets as _secrets
|
||||||
|
|
@ -213,7 +216,6 @@ def _set_profile_context():
|
||||||
def _log_slow_request(response):
|
def _log_slow_request(response):
|
||||||
"""Log slow HTTP requests so we can identify UI stall sources."""
|
"""Log slow HTTP requests so we can identify UI stall sources."""
|
||||||
try:
|
try:
|
||||||
# Skip websocket upgrades and very common noise.
|
|
||||||
path = request.path
|
path = request.path
|
||||||
if path.startswith('/socket.io/'):
|
if path.startswith('/socket.io/'):
|
||||||
return response
|
return response
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue