Add database

This commit is contained in:
Andros Fenollosa 2020-11-15 11:13:39 +01:00
parent 75de13e7a2
commit e486ebd2d5
3 changed files with 32 additions and 11 deletions

View File

@ -25,7 +25,7 @@
</aside>
<main class="column">
<!-- Mensajes -->
<section id="mensajes"></section>
<!-- Fin Mensajes -->
@ -53,6 +53,7 @@
/*
* FUNCIONES
*/
function anyadirNuevoMensajeAlHTML(nombre, texto, propio = false) {
// Contenedor
const MI_CONTENEDOR = document.createElement('div');
@ -101,13 +102,9 @@
// Recibir mensaje
CHAT_SOCKET.addEventListener('message', (event) => {
console.log('Recibido nuevo mensaje');
const miNuevaData = JSON.parse(event.data);
// Add message to View
this.addMessage(
myData.member_send === this.$store.state.info_user.id,
myData.text
);
console.log('Recibido nuevo mensaje');
const MI_NUEVA_DATA = JSON.parse(event.data);
anyadirNuevoMensajeAlHTML(MI_NUEVA_DATA.nombre, MI_NUEVA_DATA.texto, false);
});
// Enviar mensaje cuando se pulsa en Enviar

21
docker-compose.yaml Normal file
View File

@ -0,0 +1,21 @@
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

@ -70,7 +70,6 @@ TEMPLATES = [
},
]
WSGI_APPLICATION = 'mi_web.wsgi.application'
# Database
@ -78,8 +77,12 @@ WSGI_APPLICATION = 'mi_web.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}