seeded apps.epic for backend gameboard logic; core.asgi & .settings now accomodate Channels via Redis; several new libraries in reqs to accomodate

This commit is contained in:
Disco DeDisco
2026-03-12 15:05:02 -04:00
parent 69fea65bf9
commit 681a1a4cd0
18 changed files with 49 additions and 11 deletions

View File

@@ -2,6 +2,8 @@ asgiref==3.11.0
attrs==25.4.0
certifi==2025.11.12
cffi==2.0.0
channels
channels-redis
charset-normalizer==3.4.4
coverage
cssselect==1.3.0
@@ -23,6 +25,7 @@ pycparser==2.23
PySocks==1.7.1
python-dotenv
requests==2.32.5
scipy
selenium==4.39.0
sniffio==1.3.1
sortedcontainers==2.4.0
@@ -34,6 +37,7 @@ types-PyYAML==6.0.12.20250915
typing_extensions==4.15.0
tzdata==2025.3
urllib3==2.6.2
uvicorn[standard]
websocket-client==1.9.0
whitenoise==6.11.0
wsproto==1.3.2

View File

@@ -1,4 +1,6 @@
celery
channels
channels-redis
cssselect==1.3.0
Django==6.0
dj-database-url
@@ -13,5 +15,7 @@ lxml==6.0.2
psycopg2-binary
redis
requests==2.31.0
scipy
stripe
whitenoise==6.11.0
uvicorn[standard]

View File

3
src/apps/epic/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
src/apps/epic/apps.py Normal file
View File

@@ -0,0 +1,5 @@
from django.apps import AppConfig
class EpicConfig(AppConfig):
name = 'apps.epic'

View File

@@ -0,0 +1 @@
# RoomConsumer goes here

0
src/apps/epic/forms.py Normal file
View File

View File

3
src/apps/epic/models.py Normal file
View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

1
src/apps/epic/routing.py Normal file
View File

@@ -0,0 +1 @@
websocket_urlpatterns = []

View File

View File

0
src/apps/epic/urls.py Normal file
View File

3
src/apps/epic/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

1
src/apps/epic/voronoi.py Normal file
View File

@@ -0,0 +1 @@
# TODO: toroidal topology (tile seeds across boundary before computing)

View File

@@ -1,16 +1,19 @@
"""
ASGI config for core 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/6.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
import apps.epic.routing
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
application = get_asgi_application()
application = ProtocolTypeRouter({
'http': get_asgi_application(),
'websocket': AuthMiddlewareStack(
URLRouter(
apps.epic.routing.websocket_urlpatterns
)
),
})

View File

@@ -59,11 +59,13 @@ INSTALLED_APPS = [
'apps.gameboard',
# Gamer apps
'apps.lyric',
'apps.epic',
# Custom apps
'apps.api',
'apps.applets',
'functional_tests',
# Depend apps
'channels',
'compressor',
'rest_framework',
]
@@ -119,7 +121,7 @@ else:
}
}
# Celery & Redis
# Celery & Redis & Channels (oh my)
CELERY_BROKER_URL = os.environ.get('CELERY_BROKER_URL', 'redis://localhost:6379/0')
REDIS_URL = os.environ.get('REDIS_URL')
if REDIS_URL:
@@ -130,6 +132,14 @@ if REDIS_URL:
}
}
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
'hosts': [os.environ.get('REDIS_URL', 'redis://localhost:6379/1')],
},
}
}
# Password validation
# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators