Initial channels integration
This commit is contained in:
parent
63620ede64
commit
498aa1137b
|
@ -30,6 +30,7 @@ ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS')
|
||||||
# APP CONFIGURATION
|
# APP CONFIGURATION
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
DJANGO_APPS = (
|
DJANGO_APPS = (
|
||||||
|
'channels',
|
||||||
# Default Django apps:
|
# Default Django apps:
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
@ -253,9 +254,9 @@ MEDIA_URL = env("MEDIA_URL", default='/media/')
|
||||||
# URL Configuration
|
# URL Configuration
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
ROOT_URLCONF = 'config.urls'
|
ROOT_URLCONF = 'config.urls'
|
||||||
|
|
||||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
||||||
WSGI_APPLICATION = 'config.wsgi.application'
|
WSGI_APPLICATION = 'config.wsgi.application'
|
||||||
|
ASGI_APPLICATION = "config.routing.application"
|
||||||
|
|
||||||
# AUTHENTICATION CONFIGURATION
|
# AUTHENTICATION CONFIGURATION
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -284,6 +285,17 @@ CACHES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
CACHES["default"]["BACKEND"] = "django_redis.cache.RedisCache"
|
CACHES["default"]["BACKEND"] = "django_redis.cache.RedisCache"
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
cache_url = urlparse(CACHES['default']['LOCATION'])
|
||||||
|
CHANNEL_LAYERS = {
|
||||||
|
"default": {
|
||||||
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||||
|
"CONFIG": {
|
||||||
|
"hosts": [(cache_url.hostname, cache_url.port)],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
CACHES["default"]["OPTIONS"] = {
|
CACHES["default"]["OPTIONS"] = {
|
||||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||||
"IGNORE_EXCEPTIONS": True, # mimics memcache behavior.
|
"IGNORE_EXCEPTIONS": True, # mimics memcache behavior.
|
||||||
|
|
|
@ -59,3 +59,5 @@ pyacoustid>=1.1.5,<1.2
|
||||||
raven>=6.5,<7
|
raven>=6.5,<7
|
||||||
python-magic==0.4.15
|
python-magic==0.4.15
|
||||||
ffmpeg-python==0.1.10
|
ffmpeg-python==0.1.10
|
||||||
|
channels>=2,<2.1
|
||||||
|
channels_redis>=2.1,<2.2
|
||||||
|
|
|
@ -28,6 +28,11 @@ http {
|
||||||
#gzip on;
|
#gzip on;
|
||||||
proxy_cache_path /tmp/funkwhale-transcode levels=1:2 keys_zone=transcode:10m max_size=1g inactive=24h use_temp_path=off;
|
proxy_cache_path /tmp/funkwhale-transcode levels=1:2 keys_zone=transcode:10m max_size=1g inactive=24h use_temp_path=off;
|
||||||
|
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 6001;
|
listen 6001;
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
@ -40,6 +45,9 @@ http {
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_set_header X-Forwarded-Host localhost:8080;
|
proxy_set_header X-Forwarded-Host localhost:8080;
|
||||||
proxy_set_header X-Forwarded-Port 8080;
|
proxy_set_header X-Forwarded-Port 8080;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
|
||||||
location /_protected/media {
|
location /_protected/media {
|
||||||
|
|
|
@ -32,6 +32,7 @@ module.exports = {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://nginx:6001',
|
target: 'http://nginx:6001',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
|
ws: true
|
||||||
},
|
},
|
||||||
'/media': {
|
'/media': {
|
||||||
target: 'http://nginx:6001',
|
target: 'http://nginx:6001',
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.17.1",
|
"axios": "^0.17.1",
|
||||||
"dateformat": "^2.0.0",
|
"dateformat": "^2.0.0",
|
||||||
|
"django-channels": "^1.1.6",
|
||||||
"js-logger": "^1.3.0",
|
"js-logger": "^1.3.0",
|
||||||
"jwt-decode": "^2.2.0",
|
"jwt-decode": "^2.2.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
|
|
Loading…
Reference in New Issue