Bump Channels and Daphne to 4.0

This commit is contained in:
Reckless_Satoshi 2023-05-01 09:19:15 -07:00
parent 72976ab46b
commit f6f6a9244c
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 17 additions and 5 deletions

View File

@ -6,8 +6,8 @@ django-model-utils==4.3.1
django-redis==5.2.0 django-redis==5.2.0
django-timezone-field==5.0 django-timezone-field==5.0
djangorestframework==3.14.0 djangorestframework==3.14.0
channels==3.0.4 channels==4.0.0
channels-redis==3.3.1 channels-redis==4.1.0
celery==5.2.7 celery==5.2.7
grpcio==1.54.0 grpcio==1.54.0
googleapis-common-protos==1.59.0 googleapis-common-protos==1.59.0
@ -25,10 +25,10 @@ SQLAlchemy==2.0.12
django-import-export==3.2.0 django-import-export==3.2.0
requests[socks] requests[socks]
python-gnupg==0.5.0 python-gnupg==0.5.0
daphne==3.0.2 daphne==4.0.0
drf-spectacular==0.26.2 drf-spectacular==0.26.2
drf-spectacular-sidecar==2023.4.1 drf-spectacular-sidecar==2023.4.1
black==23.3.0 black==22.8.0
isort==5.12.0 isort==5.12.0
flake8==6.0.0 flake8==6.0.0
pyflakes==3.0.1 pyflakes==3.0.1

View File

@ -1,10 +1,19 @@
import os
from channels.auth import AuthMiddlewareStack from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application
import chat.routing import chat.routing
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "robosats.settings")
# Initialize Django ASGI application early to ensure the AppRegistry
# is populated before importing code that may import ORM models.
django_asgi_app = get_asgi_application()
application = ProtocolTypeRouter( application = ProtocolTypeRouter(
{ {
"http": django_asgi_app,
"websocket": AuthMiddlewareStack( "websocket": AuthMiddlewareStack(
URLRouter( URLRouter(
chat.routing.websocket_urlpatterns, chat.routing.websocket_urlpatterns,

View File

@ -49,9 +49,11 @@ ALLOWED_HOSTS = [
config("I2P_LONG"), config("I2P_LONG"),
config("LOCAL_ALIAS"), config("LOCAL_ALIAS"),
"127.0.0.1", "127.0.0.1",
"localhost",
] ]
CORS_ALLOW_ALL_ORIGINS = True CORS_ALLOW_ALL_ORIGINS = True
CSRF_TRUSTED_ORIGINS = ["http://*", "https://*"]
# Allows Session Cookie to be read by Javascript on Client side. # Allows Session Cookie to be read by Javascript on Client side.
SESSION_COOKIE_HTTPONLY = False SESSION_COOKIE_HTTPONLY = False
@ -81,15 +83,16 @@ if os.environ.get("LOG_TO_CONSOLE"):
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
"daphne",
"django.contrib.admin", "django.contrib.admin",
"django.contrib.auth", "django.contrib.auth",
"django.contrib.contenttypes", "django.contrib.contenttypes",
"django.contrib.sessions", "django.contrib.sessions",
"django.contrib.messages", "django.contrib.messages",
"channels",
"django.contrib.staticfiles", "django.contrib.staticfiles",
"corsheaders", "corsheaders",
"rest_framework", "rest_framework",
"channels",
"django_celery_beat", "django_celery_beat",
"django_celery_results", "django_celery_results",
"import_export", "import_export",