make runable on deal pc
This commit is contained in:
parent
0ed93d4649
commit
5003c6c1e3
18
.vscode/launch.json
vendored
Normal file
18
.vscode/launch.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
10
manage.py
10
manage.py
@ -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)
|
||||||
|
|
||||||
|
|||||||
@ -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()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user