diff --git a/core/chat/__init__.py b/core/chat/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/core/chat/migrations/__init__.py b/core/chat/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/core/chat/urls.py b/core/chat/urls.py new file mode 100644 index 0000000..96bbee4 --- /dev/null +++ b/core/chat/urls.py @@ -0,0 +1,8 @@ +# chat/urls.py +from django.urls import path + +from . import views + +urlpatterns = [ + path("", views.index, name="index"), +] \ No newline at end of file diff --git a/core/chat/views.py b/core/chat/views.py new file mode 100644 index 0000000..751e781 --- /dev/null +++ b/core/chat/views.py @@ -0,0 +1,5 @@ +# chat/views.py +from django.shortcuts import render + +def index(request): + return render(request, "chat/index.html") \ No newline at end of file diff --git a/core/core/asgi.py b/core/core/asgi.py index e718260..8a1496f 100644 --- a/core/core/asgi.py +++ b/core/core/asgi.py @@ -10,7 +10,15 @@ https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/ import os from django.core.asgi import get_asgi_application +from channels.routing import ProtocolTypeRouter os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') -application = get_asgi_application() +#application = get_asgi_application() + +application = ProtocolTypeRouter( + { + "http": get_asgi_application(), + # Just HTTP for now. (We can add other protocols later.) + } +) \ No newline at end of file diff --git a/core/core/settings.py b/core/core/settings.py index ae0192c..4e60f43 100644 --- a/core/core/settings.py +++ b/core/core/settings.py @@ -31,6 +31,8 @@ ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '*'] # Application definition INSTALLED_APPS = [ + 'daphne', + 'chat', 'library.apps.LibraryConfig', 'homepage.apps.HomepageConfig', 'components.apps.ComponentsConfig', @@ -128,4 +130,7 @@ STATICFILES_DIRS = [BASE_DIR / 'static'] DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' -LOGIN_URL = '/account/login/' \ No newline at end of file +LOGIN_URL = '/account/login/' + +# Daphne +ASGI_APPLICATION = "core.asgi.application" \ No newline at end of file diff --git a/core/core/urls.py b/core/core/urls.py index 0eda9f8..008b2e3 100644 --- a/core/core/urls.py +++ b/core/core/urls.py @@ -23,4 +23,5 @@ urlpatterns = [ path('', include('homepage.urls')), path('play/', include('play.urls')), path('library/', include('library.urls')), + path('chat/', include('chat.urls')), ] diff --git a/core/templates/chat/index.html b/core/templates/chat/index.html new file mode 100644 index 0000000..425e369 --- /dev/null +++ b/core/templates/chat/index.html @@ -0,0 +1,27 @@ + + + +
+ +