From 63a6da058ef153c0c3866b45161143da8a325830 Mon Sep 17 00:00:00 2001 From: Sayyid Hamid Mahdavi Date: Tue, 16 Dec 2025 18:05:45 +0330 Subject: [PATCH] daphne --- accounts/asgi.py | 16 +++++++++++ requirements.in | 4 ++- requirements.txt | 74 ++++++++++++++++++++++++++++++++++++++++++------ run.sh | 3 +- 4 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 accounts/asgi.py diff --git a/accounts/asgi.py b/accounts/asgi.py new file mode 100644 index 0000000..3116ceb --- /dev/null +++ b/accounts/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for accounts project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'accounts.settings') + +application = get_asgi_application() diff --git a/requirements.in b/requirements.in index d95440d..3205c3e 100644 --- a/requirements.in +++ b/requirements.in @@ -18,4 +18,6 @@ django-jalali-date django-betterforms psycopg[binary] django_redis -django_minio_backend \ No newline at end of file +django_minio_backend +daphne +Twisted[tls,http2] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 06169ec..9abbf48 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # # pip-compile @@ -12,16 +12,23 @@ argon2-cffi-bindings==21.2.0 # via argon2-cffi asgiref==3.8.1 # via + # daphne # django # django-cors-headers -async-timeout==5.0.1 - # via redis attrs==24.3.0 # via # jsonschema # referencing + # service-identity + # twisted +autobahn==25.11.1 + # via daphne +automat==25.4.16 + # via twisted billiard==4.2.1 # via celery +cbor2==5.7.1 + # via autobahn celery==5.4.0 # via -r requirements.in certifi==2024.12.14 @@ -46,10 +53,18 @@ click-plugins==1.1.1 # via celery click-repl==0.3.0 # via celery +constantly==23.10.4 + # via twisted crispy-bootstrap5==2024.10 # via -r requirements.in cryptography==44.0.0 - # via jwcrypto + # via + # autobahn + # jwcrypto + # pyopenssl + # service-identity +daphne==4.2.1 + # via -r requirements.in django==5.1.4 # via # -r requirements.in @@ -94,8 +109,23 @@ greenlet==3.1.1 # via gevent gunicorn==23.0.0 # via -r requirements.in +h2==4.3.0 + # via twisted +hpack==4.1.0 + # via h2 +hyperframe==6.1.0 + # via h2 +hyperlink==21.0.0 + # via + # autobahn + # twisted idna==3.10 - # via requests + # via + # hyperlink + # requests + # twisted +incremental==24.11.0 + # via twisted inflection==0.5.1 # via drf-spectacular jalali-core==1.0.0 @@ -114,22 +144,38 @@ markdown==3.7 # via -r requirements.in minio==7.2.16 # via django-minio-backend +msgpack==1.1.2 + # via autobahn oauthlib==3.2.2 # via django-oauth-toolkit packaging==24.2 - # via gunicorn + # via + # gunicorn + # incremental pillow==11.0.0 # via -r requirements.in +priority==1.3.0 + # via twisted prompt-toolkit==3.0.48 # via click-repl psycopg[binary]==3.2.3 # via -r requirements.in psycopg-binary==3.2.3 # via psycopg +py-ubjson==0.16.1 + # via autobahn +pyasn1==0.6.1 + # via + # pyasn1-modules + # service-identity +pyasn1-modules==0.4.2 + # via service-identity pycparser==2.22 # via cffi pycryptodome==3.23.0 # via minio +pyopenssl==25.1.0 + # via twisted python-dateutil==2.9.0.post0 # via celery python-decouple==3.8 @@ -150,19 +196,29 @@ rpds-py==0.22.3 # via # jsonschema # referencing +service-identity==24.2.0 + # via twisted six==1.17.0 # via python-dateutil sqlparse==0.5.3 # via django +twisted[http2,tls]==25.5.0 + # via + # -r requirements.in + # daphne +txaio==25.12.2 + # via autobahn typing-extensions==4.12.2 # via # jwcrypto # minio - # psycopg + # twisted tzdata==2024.2 # via # celery # kombu +ujson==5.11.0 + # via autobahn uritemplate==4.1.1 # via drf-spectacular urllib3==2.2.3 @@ -179,7 +235,9 @@ wcwidth==0.2.13 zope-event==5.0 # via gevent zope-interface==7.2 - # via gevent + # via + # gevent + # twisted # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/run.sh b/run.sh index a97641d..80e55fd 100755 --- a/run.sh +++ b/run.sh @@ -5,4 +5,5 @@ while ! nc -z $DB_HOST 5432 ; do done #python3 manage.py collectstatic --noinput python3 manage.py migrate -gunicorn accounts.wsgi:application --bind 0.0.0.0:8000 -w 4 \ No newline at end of file +#gunicorn accounts.wsgi:application --bind 0.0.0.0:8000 -w 4 +daphne -b 0.0.0.0 -p 8000 accounts.asgi:application \ No newline at end of file