diff --git a/apps/rc/models.py b/apps/rc/models.py index 58c0697..3543692 100644 --- a/apps/rc/models.py +++ b/apps/rc/models.py @@ -561,11 +561,11 @@ class RCConfiguration(Configuration): else: data = {'manual': [clock.multiplier, clock.divisor, clock.reference]} payload = self.request('setfreq', 'post', data=json.dumps(data)) - if payload['setfreq'] != 'ok': - self.message = 'RC write: {}'.format(payload['setfreq']) + if payload['command'] != 'ok': + self.message = 'RC write: {}'.format(payload['command']) else: - self.message = payload['setfreq'] - if payload['setfreq'] == 'fail': + self.message = payload['programming'] + if payload['programming'] == 'fail': self.message = 'RC write: error programming CGS chip' values = [] diff --git a/docker-compose.yml b/docker-compose.yml index f8b7817..ba81fdb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,28 @@ version: '2' services: # Django app - # web: - # container_name: 'radarsys' - # build: . - # restart: always - # image: radarsys - # command: gunicorn radarsys.wsgi:application -w 2 -b :8000 - # #command: python manage.py runserver 0.0.0.0:8030 - # ports: - # - 8000:8000 - # #ports: - # # - 8030:8030 - # env_file: .env + web: + container_name: 'radarsys' + build: . + restart: always + image: radarsys + command: gunicorn radarsys.wsgi:application -w 2 -b :8000 + #command: python manage.py runserver 0.0.0.0:8000 + ports: + - 8000:8000 + #ports: + # - 8030:8030 + env_file: .env - # links: - # # - redis - # - postgres - # volumes: - # - './:/radarsys' - # - '${DOCKER_DATA}/static:/radarsys/static' - # depends_on: - # # - redis - # - postgres + links: + # - redis + - postgres + volumes: + - './:/radarsys' + - '${DOCKER_DATA}/static:/radarsys/static' + depends_on: + # - redis + - postgres # redis: # container_name: 'radarsys-redis' @@ -55,19 +55,19 @@ services: - POSTGRES_DB=radarsys env_file: .env - # #Web Server - # nginx: - # container_name: 'radarsys-nginx' - # restart: always - # build: ./nginx/ - # ports: - # - '8030:8030' - # volumes_from: - # - web - # links: - # - web:web - # depends_on: - # - web + #Web Server + nginx: + container_name: 'radarsys-nginx' + restart: always + build: ./nginx/ + ports: + - '8030:8030' + volumes_from: + - web + links: + - web:web + depends_on: + - web volumes: pgdata: diff --git a/nginx/Dockerfile b/nginx/Dockerfile index ce5ded4..b772111 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,3 +1,3 @@ -FROM nginx:1.13.8-alpine +FROM nginx:1.22.1-alpine RUN rm /etc/nginx/conf.d/default.conf ADD sites-enabled/radarsys.conf /etc/nginx/conf.d/ diff --git a/nginx/sites-enabled/radarsys.conf b/nginx/sites-enabled/radarsys.conf index 8b7d76b..8f78b39 100644 --- a/nginx/sites-enabled/radarsys.conf +++ b/nginx/sites-enabled/radarsys.conf @@ -11,7 +11,10 @@ server { } location / { + proxy_set_header Host "localhost"; proxy_pass http://web:8000; + # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } } diff --git a/radarsys/settings.py b/radarsys/settings.py index c5d65d1..49e54ee 100644 --- a/radarsys/settings.py +++ b/radarsys/settings.py @@ -26,6 +26,11 @@ DEBUG = True ALLOWED_HOSTS = ['*'] +CSRF_TRUSTED_ORIGINS=[ + "http://*.localhost:8030" +] +#Si se requiere que la aplicación salga de este entorno, para otros usuarios es necesario hacer una API request https://fractalideas.com/blog/making-react-and-django-play-well-together-single-page-app-model/ + # Application definition INSTALLED_APPS = [