Add requirements

This commit is contained in:
Andros Fenollosa 2020-11-17 23:42:59 +01:00
parent a4054b8efe
commit 7098714788
6 changed files with 22 additions and 63 deletions

18
asgi.py
View File

@ -1,18 +0,0 @@
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mi_web.settings")
import django
django.setup()
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application
from apps.chat.routing import websocket_urlpatterns
application = ProtocolTypeRouter(
{
"websocket": AuthMiddlewareStack(URLRouter(websocket_urlpatterns)),
}
)

View File

@ -2,20 +2,8 @@ version: '3.1'
services:
db:
image: postgres
restart: always
volumes:
- ./postgres:/var/lib/postgresql/data
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
redis:
image: redis:alpine
restart: always
ports:
- 6379:6379

View File

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

View File

@ -77,12 +77,8 @@ TEMPLATES = [
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': '127.0.0.1',
'PORT': '5432',
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'mydatabase',
}
}
@ -126,6 +122,7 @@ USE_TZ = False
STATIC_URL = '/static/'
ASGI_APPLICATION = "asgi.application"
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",

View File

@ -1,16 +0,0 @@
"""
WSGI config for mi_web project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mi_web.settings')
application = get_wsgi_application()

6
requirements.txt Normal file
View File

@ -0,0 +1,6 @@
# Servidor asincrono para Django
daphne==2.4.1
# Channels
channels==2.4.0
# Conector de Redis para Channels
channels_redis