Proyecto LCX Dispatcharr multicuenta
Base Image Build / prepare (push) Has been cancelled
Build and Push Multi-Arch Docker Image / build-and-push (push) Has been cancelled
Frontend Tests / test (push) Has been cancelled
Base Image Build / docker (amd64, ubuntu-24.04) (push) Has been cancelled
Base Image Build / docker (arm64, ubuntu-24.04-arm) (push) Has been cancelled
Base Image Build / create-manifest (push) Has been cancelled
Base Image Build / prepare (push) Has been cancelled
Build and Push Multi-Arch Docker Image / build-and-push (push) Has been cancelled
Frontend Tests / test (push) Has been cancelled
Base Image Build / docker (amd64, ubuntu-24.04) (push) Has been cancelled
Base Image Build / docker (arm64, ubuntu-24.04-arm) (push) Has been cancelled
Base Image Build / create-manifest (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
def is_management_command(excluded_commands=None):
|
||||
"""
|
||||
Detect if we're running a Django management command like migrate, collectstatic, etc.
|
||||
|
||||
Args:
|
||||
excluded_commands: List of commands that should still use Redis (e.g. runserver)
|
||||
|
||||
Returns:
|
||||
bool: True if we're running a management command
|
||||
"""
|
||||
# First check if we're in build mode
|
||||
if os.environ.get("DISPATCHARR_BUILD") == "1":
|
||||
return True
|
||||
|
||||
if excluded_commands is None:
|
||||
excluded_commands = ['runserver', 'runworker', 'daphne']
|
||||
|
||||
# Check if we're running via manage.py
|
||||
if not ('manage.py' in sys.argv[0]):
|
||||
return False
|
||||
|
||||
# Check if we have a command argument
|
||||
if len(sys.argv) > 1:
|
||||
command = sys.argv[1]
|
||||
# Return False if command is in excluded list - these commands DO need Redis
|
||||
if command in excluded_commands:
|
||||
return False
|
||||
# Otherwise it's a command that should work without Redis
|
||||
return True
|
||||
|
||||
return False
|
||||
Reference in New Issue
Block a user