From baf7f4cba0a1cb75a67feb4577eda94b0b4ceadc Mon Sep 17 00:00:00 2001 From: Jennings Zhang Date: Thu, 17 Oct 2024 17:49:55 -0400 Subject: [PATCH] Replace daphne with granian --- Dockerfile | 2 +- chris_backend/config/settings/common.py | 1 - docker-compose_just.yml | 2 +- requirements/base.txt | 3 ++- requirements/local.txt | 2 ++ requirements/production.txt | 1 - 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 50279c13..bd47cc5d 100755 --- a/Dockerfile +++ b/Dockerfile @@ -39,4 +39,4 @@ COPY chris_backend/ ./ RUN if [ "$ENVIRONMENT" = "production" ]; then \ env DJANGO_SETTINGS_MODULE=config.settings.common ./manage.py collectstatic; fi -CMD ["daphne", "-b", "0.0.0.0", "-p", "8000", "config.asgi:application"] +CMD ["granian", "--host", "0.0.0.0", "--interface", "asginl", "config.asgi:application"] diff --git a/chris_backend/config/settings/common.py b/chris_backend/config/settings/common.py index 6de70270..afb91c3c 100755 --- a/chris_backend/config/settings/common.py +++ b/chris_backend/config/settings/common.py @@ -28,7 +28,6 @@ # Application definition INSTALLED_APPS = [ - 'daphne', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/docker-compose_just.yml b/docker-compose_just.yml index fdfd3b65..7598097c 100755 --- a/docker-compose_just.yml +++ b/docker-compose_just.yml @@ -22,7 +22,6 @@ services: context: . args: ENVIRONMENT: local - command: bash -c 'python manage.py runserver 0.0.0.0:8000 2> >(grep -vF "HTTP GET /api/v1/users/ 200" 1>&2)' ports: - "8000:8000" volumes: &CHRIS_VOLUMES @@ -32,6 +31,7 @@ services: DJANGO_SETTINGS_MODULE: "config.settings.local" STORAGE_ENV: "fslink" SPECTACULAR_SPLIT_REQUEST: "${SPECTACULAR_SPLIT_REQUEST-false}" + GRANIAN_RELOAD: "true" user: ${UID:?Please run me using just.}:${GID:?Please run me using just.} profiles: - cube diff --git a/requirements/base.txt b/requirements/base.txt index 6fb48073..13a03260 100755 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -14,6 +14,7 @@ django-auth-ldap==4.5.0 PyYAML==6.0.1 whitenoise[brotli]==6.5.0 PyJWT===2.8.0 -channels[daphne]==4.1.0 +channels==4.1.0 nats-py==2.9.0 +granian==1.6.1 git+https://github.com/tfranzel/drf-spectacular.git@refs/pull/1307/head diff --git a/requirements/local.txt b/requirements/local.txt index 3eec12c9..4db33915 100755 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -8,4 +8,6 @@ pylint==2.17.5 flake8==6.1.0 isort==5.12.0 pudb==2022.1.3 +daphne==4.1.2 # required by (django) channels.testing +granian[reload] https://github.com/msbrogli/rpudb/archive/master.zip diff --git a/requirements/production.txt b/requirements/production.txt index 8e284f30..2c8922da 100755 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -1,3 +1,2 @@ -r base.txt # includes the base.txt requirements -gunicorn==21.2.0