Merge branch 'develope' of https://dxpgit.homeunix.com/ilanq7/remoteadmin into develope

This commit is contained in:
dxpgitbuki 2025-10-25 08:41:34 +02:00
commit 79430deab9
3 changed files with 29 additions and 8 deletions

18
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Daphne ASGI server",
"type": "debugpy",
"request": "launch",
"module": "daphne",
"args": ["-b", "127.0.0.1", "-p", "8001", "project.config.asgi:application"],
"justMyCode": true,
"env": {
"DJANGO_SETTINGS_MODULE": "project.config.settings"
},
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
}
]
}

View File

@ -4,10 +4,12 @@ import sys
from pathlib import Path from pathlib import Path
def main(): def main():
project_dir = Path(__file__).resolve().parent / 'project' # Ensure the repository root (containing the 'project' package) is on sys.path.
if str(project_dir) not in sys.path: repo_root = Path(__file__).resolve().parent
sys.path.insert(0, str(project_dir)) if str(repo_root) not in sys.path:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.config.settings') sys.path.insert(0, str(repo_root))
# Force correct settings module even if an old environment var (e.g. 'dali.settings') lingers.
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.config.settings'
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)

View File

@ -5,11 +5,12 @@ from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack from channels.auth import AuthMiddlewareStack
project_dir = Path(__file__).resolve().parent.parent # Add repository root so 'project' package is importable regardless of CWD.
if str(project_dir) not in sys.path: repo_root = Path(__file__).resolve().parent.parent.parent
sys.path.insert(0, str(project_dir)) if str(repo_root) not in sys.path:
sys.path.insert(0, str(repo_root))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.config.settings') os.environ['DJANGO_SETTINGS_MODULE'] = 'project.config.settings'
http_app = get_asgi_application() http_app = get_asgi_application()