Add voice channel functionality with WebRTC peer-to-peer audio: - Add VoiceSignalingConsumer for WebRTC signaling and peer coordination - Add GlobalConsumer for real-time presence and voice status updates - Add voice channel type to Channel model with current_voice_channel tracking on UserProfile - Add voice controls UI (mute, deafen, disconnect) in status panel - Add voice member list display in sidebar with avatar support - Add
117 lines
3.5 KiB
Python
117 lines
3.5 KiB
Python
import os
|
|
from pathlib import Path
|
|
from decouple import config
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
SECRET_KEY = config('SECRET_KEY', default='poc-secret-key')
|
|
DEBUG = config('DEBUG', default=True, cast=bool)
|
|
ALLOWED_HOSTS = ['*']
|
|
CSRF_TRUSTED_ORIGINS=['https://*.bigoscloud.com']
|
|
INSTALLED_APPS = [
|
|
'daphne',
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'channels',
|
|
'rest_framework',
|
|
'chat',
|
|
'channels_postgres',
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'core.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.request',
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.contrib.messages.context_processors.messages',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
ASGI_APPLICATION = 'core.asgi.application'
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': config('DB_NAME', default='discord_db'),
|
|
'USER': config('DB_USER', default='discord_user'),
|
|
'PASSWORD': config('DB_PASSWORD', default='discord_pass'),
|
|
'HOST': config('DB_HOST', default='localhost'),
|
|
'PORT': config('DB_PORT', default='5432'),
|
|
},
|
|
'channels_postgres': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': config('DB_NAME', default='discord_db'),
|
|
'USER': config('DB_USER', default='discord_user'),
|
|
'PASSWORD': config('DB_PASSWORD', default='discord_pass'),
|
|
'HOST': config('DB_HOST', default='localhost'),
|
|
'PORT': config('DB_PORT', default='5432'),
|
|
}
|
|
}
|
|
|
|
CHANNEL_LAYERS = {
|
|
'default': {
|
|
'BACKEND': 'channels_postgres.core.PostgresChannelLayer',
|
|
'CONFIG': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': config('DB_NAME', default='discord_db'),
|
|
'USER': config('DB_USER', default='discord_user'),
|
|
'PASSWORD': config('DB_PASSWORD', default='discord_pass'),
|
|
'HOST': config('DB_HOST', default='localhost'),
|
|
'PORT': config('DB_PORT', default='5432'),
|
|
'TIME_ZONE': 'UTC',
|
|
'CONN_MAX_AGE': 0,
|
|
'OPTIONS': {},
|
|
'AUTOCOMMIT': True,
|
|
},
|
|
},
|
|
}
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
TIME_ZONE = 'UTC'
|
|
USE_I18N = True
|
|
USE_TZ = True
|
|
|
|
STATIC_URL = '/static/'
|
|
STATIC_ROOT = BASE_DIR / 'static'
|
|
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = BASE_DIR / 'media'
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
LOGIN_URL = '/login/'
|
|
LOGIN_REDIRECT_URL = '/'
|
|
LOGOUT_REDIRECT_URL = '/login/'
|
|
|
|
# PoC: allow large file uploads
|
|
DATA_UPLOAD_MAX_MEMORY_SIZE = 52428800 # 50MB
|
|
FILE_UPLOAD_MAX_MEMORY_SIZE = 52428800
|
|
|
|
# Cloudflare Realtime TURN Configuration
|
|
CLOUDFLARE_ACCOUNT_ID = config('CLOUDFLARE_ACCOUNT_ID', default='')
|
|
CLOUDFLARE_API_TOKEN = config('CLOUDFLARE_API_TOKEN', default='')
|
|
CLOUDFLARE_TURN_KEY_ID = config('CLOUDFLARE_TURN_KEY_ID', default='')
|