diff --git a/CONFIGURATION_FR.md b/CONFIGURATION_FR.md index 68cdb86014..6c8ba7b491 100644 --- a/CONFIGURATION_FR.md +++ b/CONFIGURATION_FR.md @@ -340,7 +340,7 @@ Il faudra pour cela créer un fichier de langue et traduire chaque entrée.
>> d’encodage ou de flux RSS si la variable `CONTACT_US_EMAIL` n’est pas renseignée.

>> _ref : [docs.djangoproject.com](https://docs.djangoproject.com/fr/3.2/ref/settings/#admins)_
* `ALLOWED_HOSTS` - > valeur par défaut : `['localhost']` + > valeur par défaut : `['pod.localhost']` >> Une liste de chaînes représentant des noms de domaine/d’hôte que ce site Django peut servir.

>> C’est une mesure de sécurité pour empêcher les attaques d’en-tête Host HTTP,
>> qui sont possibles même avec bien des configurations de serveur Web apparemment sécurisées.

@@ -359,7 +359,7 @@ Il faudra pour cela créer un fichier de langue et traduire chaque entrée.
>> # }, >> "default": { >> "BACKEND": "django_redis.cache.RedisCache", - >> "LOCATION": "redis://127.0.0.1:6379/1", + >> "LOCATION": "redis://redis.localhost:6379/1", >> "OPTIONS": { >> "CLIENT_CLASS": "django_redis.client.DefaultClient", >> }, @@ -367,7 +367,7 @@ Il faudra pour cela créer un fichier de langue et traduire chaque entrée.
>> # Persistent cache setup for select2 (NOT DummyCache or LocMemCache). >> "select2": { >> "BACKEND": "django_redis.cache.RedisCache", - >> "LOCATION": "redis://127.0.0.1:6379/2", + >> "LOCATION": "redis://redis.localhost:6379/2", >> "OPTIONS": { >> "CLIENT_CLASS": "django_redis.client.DefaultClient", >> }, @@ -1934,7 +1934,7 @@ Il est possible d’encoder en local ou en distant.
Attention, il faut configurer Celery pour l’envoi des instructions pour l’encodage distant.
* `CELERY_BROKER_URL` - > valeur par défaut : `redis://127.0.0.1:6379/5` + > valeur par défaut : `redis://redis.localhost:6379/5` >> URL du courtier de messages où Celery stocke les ordres d’encodage et de transcription.
* `CELERY_TO_ENCODE` > valeur par défaut : `False` @@ -1976,7 +1976,7 @@ Attention, il faut configurer Celery pour l’envoi des instructions pour l’en >> >> Il faut renseigner l’url du redis sur lequel Celery
>> va chercher les ordres d’encodage et de transcription
- >> par exemple : "redis://redis:6379/7"
+ >> par exemple : "redis://redis.localhost:6379/7"
* `FORMAT_CHOICES` > valeur par défaut : `()` >> Format d’encodage réalisé sur la plateforme.
@@ -2057,7 +2057,7 @@ Attention, il faut configurer Celery pour l’envoi des instructions pour l’en > valeur par défaut : `30` >> Valeur de timeout pour ElasticSearch.
* `ES_URL` - > valeur par défaut : `["http://127.0.0.1:9200/"]` + > valeur par défaut : `["http://elasticsearch.localhost:9200/"]` >> Adresse du ou des instances d’Elasticsearch utilisées pour
>> l’indexation et la recherche de vidéo.
* `ES_VERSION` diff --git a/Makefile b/Makefile index 3a431c9263..f5eaae6da9 100755 --- a/Makefile +++ b/Makefile @@ -12,16 +12,16 @@ help: # Démarre le serveur de test start: - (sleep 15 ; open http://localhost:8000) & - python3 manage.py runserver localhost:8000 --insecure + (sleep 15 ; open http://pod.localhost:8000) & + python3 manage.py runserver pod.localhost:8000 --insecure # --insecure let serve static files even when DEBUG=False # Démarre le serveur de test en https auto-signé starts: # nécessite les django-extensions # cf https://timonweb.com/django/https-django-development-server-ssl-certificate/ - (sleep 15 ; open https://localhost:8000) & - python3 manage.py runserver_plus localhost:8000 --cert-file cert.pem --key-file key.pem + (sleep 15 ; open https://pod.localhost:8000) & + python3 manage.py runserver_plus pod.localhost:8000 --cert-file cert.pem --key-file key.pem # Première installation de pod (BDD SQLite intégrée) install: diff --git a/docker-compose-dev-with-volumes.yml b/docker-compose-dev-with-volumes.yml index 36934b3b59..832786fca4 100755 --- a/docker-compose-dev-with-volumes.yml +++ b/docker-compose-dev-with-volumes.yml @@ -9,6 +9,7 @@ version: '3.7' services: pod: container_name: pod-dev-with-volumes + hostname: pod.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod/Dockerfile @@ -23,6 +24,7 @@ services: elasticsearch: container_name: elasticsearch-with-volumes + hostname: elasticsearch.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/elasticsearch/dockerfile-elasticsearch-dev @@ -36,6 +38,7 @@ services: redis: container_name: redis-with-volumes + hostname: redis.localhost image: ${REDIS_TAG} env_file: - ./.env.dev @@ -44,7 +47,7 @@ services: # redis-commander: # container_name: redis-commander -# hostname: redis-commander +# hostname: redis-commander.localhost # image: rediscommander/redis-commander:latest # restart: always # environment: diff --git a/docker-compose-full-dev-with-volumes-test.yml b/docker-compose-full-dev-with-volumes-test.yml index 7a369f8e99..505f066c46 100755 --- a/docker-compose-full-dev-with-volumes-test.yml +++ b/docker-compose-full-dev-with-volumes-test.yml @@ -9,6 +9,7 @@ version: '3.7' services: pod-back: container_name: pod-back-with-volumes + hostname: pod.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod-back/Dockerfile @@ -23,6 +24,7 @@ services: pod-encode: container_name: pod-encode-with-volumes + hostname: pod-encode.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod-encode/Dockerfile @@ -34,6 +36,7 @@ services: pod-transcript: container_name: pod-transcript-with-volumes + hostname: pod-transcript.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod-transcript/Dockerfile @@ -45,6 +48,7 @@ services: pod-xapi: container_name: pod-xapi-with-volumes + hostname: pod-xapi.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod-xapi/Dockerfile @@ -56,6 +60,7 @@ services: elasticsearch: container_name: elasticsearch-with-volumes + hostname: elasticsearch.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/elasticsearch/dockerfile-elasticsearch-dev @@ -69,6 +74,7 @@ services: redis: container_name: redis-with-volumes + hostname: redis.localhost image: ${REDIS_TAG} env_file: - ./.env.dev @@ -86,7 +92,7 @@ services: # redis-commander: # container_name: redis-commander -# hostname: redis-commander +# hostname: redis-commander.localhost # image: rediscommander/redis-commander:latest # restart: always # environment: diff --git a/docker-compose-full-dev-with-volumes.yml b/docker-compose-full-dev-with-volumes.yml index b6992bfefe..8e64940b46 100755 --- a/docker-compose-full-dev-with-volumes.yml +++ b/docker-compose-full-dev-with-volumes.yml @@ -9,6 +9,7 @@ version: '3.7' services: pod-back: container_name: pod-back-with-volumes + hostname: pod.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod-back/Dockerfile @@ -23,6 +24,7 @@ services: pod-encode: container_name: pod-encode-with-volumes + hostname: pod-encode.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod-encode/Dockerfile @@ -34,6 +36,7 @@ services: pod-transcript: container_name: pod-transcript-with-volumes + hostname: pod-transcript.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod-transcript/Dockerfile @@ -45,6 +48,7 @@ services: pod-xapi: container_name: pod-xapi-with-volumes + hostname: pod-xapi.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/pod-xapi/Dockerfile @@ -56,6 +60,7 @@ services: elasticsearch: container_name: elasticsearch-with-volumes + hostname: elasticsearch.localhost build: context: . dockerfile: dockerfile-dev-with-volumes/elasticsearch/dockerfile-elasticsearch-dev @@ -69,6 +74,7 @@ services: redis: container_name: redis-with-volumes + hostname: redis.localhost image: ${REDIS_TAG} env_file: - ./.env.dev @@ -77,7 +83,7 @@ services: # redis-commander: # container_name: redis-commander -# hostname: redis-commander +# hostname: redis-commander.localhost # image: rediscommander/redis-commander:latest # restart: always # environment: diff --git a/dockerfile-dev-with-volumes/README.adoc b/dockerfile-dev-with-volumes/README.adoc index 5625e5d806..d8b7ec8d17 100755 --- a/dockerfile-dev-with-volumes/README.adoc +++ b/dockerfile-dev-with-volumes/README.adoc @@ -8,7 +8,7 @@ v1.2, 2023-08-30 == Docker / docker compose avec volumes sur la machine hôte === Conteneur ElasticSearch -http://localhost:9200 +http://elasticsearch.localhost:9200 ==== elasticsearch:8.8.1 ===== OS/ARCH @@ -68,13 +68,13 @@ SECRET_KEY = "A_CHANGER" DEBUG = True # on précise ici qu'on utilise ES version 8 ES_VERSION = 8 -ES_URL = ['http://elasticsearch:9200/'] +ES_URL = ['http://elasticsearch.localhost:9200/'] CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://redis:6379/3", + "LOCATION": "redis://redis.localhost:6379/3", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", }, @@ -82,7 +82,7 @@ CACHES = { }, "select2": { "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://redis:6379/2", + "LOCATION": "redis://redis.localhost:6379/2", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", }, @@ -90,7 +90,7 @@ CACHES = { } SESSION_ENGINE = "redis_sessions.session" SESSION_REDIS = { - "host": "redis", + "host": "redis.localhost", "port": 6379, "db": 4, "prefix": "session", @@ -103,7 +103,7 @@ MIGRATION_MODULES = {'flatpages': 'pod.db_migrations'} # Si DOCKER_ENV = full il faut activer l'encodage et la transcription distante # USE_REMOTE_ENCODING_TRANSCODING = True -# ENCODING_TRANSCODING_CELERY_BROKER_URL = "redis://redis:6379/7" +# ENCODING_TRANSCODING_CELERY_BROKER_URL = "redis://redis.localhost:6379/7" # pour avoir le maximum de log sur la console LOGGING = {} diff --git a/dockerfile-dev-with-volumes/pod-back/my-entrypoint-back.sh b/dockerfile-dev-with-volumes/pod-back/my-entrypoint-back.sh index 7a23c3061f..e1faecd7d2 100644 --- a/dockerfile-dev-with-volumes/pod-back/my-entrypoint-back.sh +++ b/dockerfile-dev-with-volumes/pod-back/my-entrypoint-back.sh @@ -3,14 +3,14 @@ echo "Launching commands into pod-dev" mkdir -p pod/node_modules mkdir -p pod/db_migrations && touch pod/db_migrations/__init__.py ln -fs /tmp/node_modules/* pod/node_modules -until nc -z elasticsearch 9200; do echo waiting for elasticsearch; sleep 10; done; +until nc -z elasticsearch.localhost 9200; do echo waiting for elasticsearch; sleep 10; done; # Mise en route # Base de données SQLite intégrée BDD_FILE=/usr/src/app/pod/db.sqlite3 if test ! -f "$BDD_FILE"; then echo "$BDD_FILE does not exist." python3 manage.py create_pod_index - curl -XGET "elasticsearch:9200/pod/_search" + curl -XGET "elasticsearch.localhost:9200/pod/_search" # Deployez les fichiers statiques python3 manage.py collectstatic --no-input --clear # Lancez le script présent à la racine afin de créer les fichiers de migration, puis de les lancer pour créer la base de données SQLite intégrée. diff --git a/dockerfile-dev-with-volumes/pod-encode/my-entrypoint-encode.sh b/dockerfile-dev-with-volumes/pod-encode/my-entrypoint-encode.sh index a776115a05..8de5ff309f 100644 --- a/dockerfile-dev-with-volumes/pod-encode/my-entrypoint-encode.sh +++ b/dockerfile-dev-with-volumes/pod-encode/my-entrypoint-encode.sh @@ -1,6 +1,6 @@ #!/bin/sh echo "Launching commands into pod-dev" -until nc -z pod-back 8000; do echo waiting for pod-back; sleep 10; done; +until nc -z pod.localhost 8000; do echo waiting for pod-back; sleep 10; done; # Serveur d'encodage celery -A pod.video_encode_transcript.encoding_tasks worker -l INFO -Q encoding --concurrency 1 -n encode sleep infinity diff --git a/dockerfile-dev-with-volumes/pod-transcript/my-entrypoint-transcript.sh b/dockerfile-dev-with-volumes/pod-transcript/my-entrypoint-transcript.sh index 08db3ae978..ba162e0958 100644 --- a/dockerfile-dev-with-volumes/pod-transcript/my-entrypoint-transcript.sh +++ b/dockerfile-dev-with-volumes/pod-transcript/my-entrypoint-transcript.sh @@ -1,6 +1,6 @@ #!/bin/sh echo "Launching commands into pod-dev" -until nc -z pod-back 8000; do echo waiting for pod-back; sleep 10; done; +until nc -z pod.localhost 8000; do echo waiting for pod-back; sleep 10; done; # Serveur d'encodage celery -A pod.video_encode_transcript.transcripting_tasks worker -l INFO -Q transcripting --concurrency 1 -n transcript sleep infinity diff --git a/dockerfile-dev-with-volumes/pod-xapi/my-entrypoint-xapi.sh b/dockerfile-dev-with-volumes/pod-xapi/my-entrypoint-xapi.sh index f41937b01e..2480c11b5e 100644 --- a/dockerfile-dev-with-volumes/pod-xapi/my-entrypoint-xapi.sh +++ b/dockerfile-dev-with-volumes/pod-xapi/my-entrypoint-xapi.sh @@ -1,6 +1,6 @@ #!/bin/sh echo "Launching commands into pod-dev" -until nc -z pod-back 8000; do echo waiting for pod-back; sleep 10; done; +until nc -z pod.localhost 8000; do echo waiting for pod-back; sleep 10; done; # Serveur xAPI celery -A pod.xapi.xapi_tasks worker -l INFO -Q xapi --concurrency 1 -n xapi sleep infinity diff --git a/dockerfile-dev-with-volumes/pod/my-entrypoint.sh b/dockerfile-dev-with-volumes/pod/my-entrypoint.sh index 7a23c3061f..0024b95388 100644 --- a/dockerfile-dev-with-volumes/pod/my-entrypoint.sh +++ b/dockerfile-dev-with-volumes/pod/my-entrypoint.sh @@ -10,7 +10,7 @@ BDD_FILE=/usr/src/app/pod/db.sqlite3 if test ! -f "$BDD_FILE"; then echo "$BDD_FILE does not exist." python3 manage.py create_pod_index - curl -XGET "elasticsearch:9200/pod/_search" + curl -XGET "elasticsearch.localhost:9200/pod/_search" # Deployez les fichiers statiques python3 manage.py collectstatic --no-input --clear # Lancez le script présent à la racine afin de créer les fichiers de migration, puis de les lancer pour créer la base de données SQLite intégrée. diff --git a/pod/bbb/tests/test_models.py b/pod/bbb/tests/test_models.py index 7da00c0a41..e4a5e7a63a 100644 --- a/pod/bbb/tests/test_models.py +++ b/pod/bbb/tests/test_models.py @@ -68,9 +68,9 @@ def test_update_attributes(self): # Test delete object def test_delete_object(self): Meeting.objects.filter(meeting_id="id1").delete() - self.assertEquals(Meeting.objects.all().count(), 1) + self.assertEqual(Meeting.objects.all().count(), 1) Meeting.objects.filter(meeting_id="id2").delete() - self.assertEquals(Meeting.objects.all().count(), 0) + self.assertEqual(Meeting.objects.all().count(), 0) print(" ---> test_delete_object of MeetingTestCase: OK!") @@ -137,9 +137,9 @@ def test_update_attributes(self): # Test delete object def test_delete_object(self): Attendee.objects.filter(id=1).delete() - self.assertEquals(Attendee.objects.all().count(), 1) + self.assertEqual(Attendee.objects.all().count(), 1) Attendee.objects.filter(id=2).delete() - self.assertEquals(Attendee.objects.all().count(), 0) + self.assertEqual(Attendee.objects.all().count(), 0) print(" ---> test_delete_object of AttendeeTestCase: OK!") @@ -202,6 +202,6 @@ def test_update_attributes(self): # Test delete object def test_delete_object(self): Livestream.objects.filter(id=1).delete() - self.assertEquals(Livestream.objects.all().count(), 0) + self.assertEqual(Livestream.objects.all().count(), 0) print(" ---> test_delete_object of LivestreamTestCase: OK!") diff --git a/pod/custom/settings_local_docker_full_test.py b/pod/custom/settings_local_docker_full_test.py index 986ca7681a..884d291c9e 100644 --- a/pod/custom/settings_local_docker_full_test.py +++ b/pod/custom/settings_local_docker_full_test.py @@ -26,11 +26,11 @@ # We specify here that we're using ES version 7\n ES_VERSION = 7 -ES_URL = ['http://elasticsearch:9200/'] +ES_URL = ['http://elasticsearch.localhost:9200/'] CACHES = { 'default': { 'BACKEND': 'django_redis.cache.RedisCache', - 'LOCATION': 'redis://redis:6379/3', + 'LOCATION': 'redis://redis.localhost:6379/3', 'OPTIONS': { 'CLIENT_CLASS': 'django_redis.client.DefaultClient', }, @@ -38,7 +38,7 @@ }, 'select2': { 'BACKEND': 'django_redis.cache.RedisCache', - 'LOCATION': 'redis://redis:6379/2', + 'LOCATION': 'redis://redis.localhost:6379/2', 'OPTIONS': { 'CLIENT_CLASS': 'django_redis.client.DefaultClient', }, @@ -46,7 +46,7 @@ } SESSION_ENGINE = 'redis_sessions.session' SESSION_REDIS = { - 'host': 'redis', + 'host': 'redis.localhost', 'port': 6379, 'db': 4, 'prefix': 'session', @@ -59,8 +59,8 @@ # If DOCKER_ENV = full: activate encoding, transcription and remote xapi USE_REMOTE_ENCODING_TRANSCODING = True -ENCODING_TRANSCODING_CELERY_BROKER_URL = 'redis://redis:6379/7' -POD_API_URL = "http://pod-back:8000/rest" +ENCODING_TRANSCODING_CELERY_BROKER_URL = 'redis://redis.localhost:6379/7' +POD_API_URL = "http://pod.localhost:8000/rest" POD_API_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" USE_TRANSCRIPTION = True @@ -79,7 +79,7 @@ } USE_XAPI_VIDEO = False -XAPI_CELERY_BROKER_URL = "redis://redis:6379/6" +XAPI_CELERY_BROKER_URL = "redis://redis.localhost:6379/6" # for maximum console logging\n LOGGING = {} diff --git a/pod/live/tests/test_models.py b/pod/live/tests/test_models.py index 4b9ef785ec..392150f8f7 100644 --- a/pod/live/tests/test_models.py +++ b/pod/live/tests/test_models.py @@ -290,7 +290,9 @@ def test_attributs(self): event.id = None self.assertEqual(event.__str__(), "None") self.assertEqual(event.get_thumbnail_card(), "/static/img/default-event.svg") - self.assertEqual(event.get_full_url(), "//localhost:8000/live/event/0001-event1/") + self.assertEqual( + event.get_full_url(), "//pod.localhost:8000/live/event/0001-event1/" + ) print(" ---> test_attributs of EventTestCase: OK!") def test_add_thumbnail(self): @@ -316,19 +318,19 @@ def test_add_video_on_hold(self): event = Event.objects.get(id=1) event.video_on_hold = video event.save() - self.assertEquals(event.video_on_hold.id, video.id) + self.assertEqual(event.video_on_hold.id, video.id) print(" ---> test_add_video_on_hold of EventTestCase: OK!") def test_add_video(self): event = Event.objects.get(id=1) event = add_video(event) - self.assertEquals(event.videos.count(), 1) + self.assertEqual(event.videos.count(), 1) print(" ---> test_add_video of EventTestCase: OK!") def test_delete_object(self): event = Event.objects.get(id=1) event.delete() - self.assertEquals(Event.objects.all().count(), 0) + self.assertEqual(Event.objects.all().count(), 0) print(" ---> test_delete_object of EventTestCase: OK!") def test_delete_object_keep_video(self): @@ -336,7 +338,7 @@ def test_delete_object_keep_video(self): add_video(event) event.delete() # video is not deleted with event - self.assertEquals(Video.objects.all().count(), 1) + self.assertEqual(Video.objects.all().count(), 1) print(" ---> test_delete_object_keep_video of EventTestCase: OK!") def test_event_filters(self): diff --git a/pod/live/tests/test_utils.py b/pod/live/tests/test_utils.py index 0eff96478f..b26a66e683 100644 --- a/pod/live/tests/test_utils.py +++ b/pod/live/tests/test_utils.py @@ -36,17 +36,17 @@ def test_send_email(self): event = Event.objects.get(id=1) bcc = get_bcc(1) - self.assertEquals(bcc, []) + self.assertEqual(bcc, []) print(" ---> test_utils get_bcc ok") expected = ["first", "second"] bcc = get_bcc(expected) - self.assertEquals(bcc, expected) + self.assertEqual(bcc, expected) print(" ---> test_utils get_bcc liste or tuple ok") expected = "first" bcc = get_bcc(expected) - self.assertEquals(bcc, expected.split()) + self.assertEqual(bcc, expected.split()) print(" ---> test_utils get_bcc string ok") expected = ["emailadduser1", "emailadduser2"] @@ -55,7 +55,7 @@ def test_send_email(self): event.additional_owners.set([additional_user1, additional_user2]) cc = get_cc(event) - self.assertEquals(cc, expected) + self.assertEqual(cc, expected) print(" ---> test_utils get_cc ok") # TODO test this for real @@ -66,17 +66,17 @@ def test_date_string_to_second(self): """Teste la conversion d'une chaine de caractère en nombre de secondes.""" from pod.live.utils import date_string_to_second - self.assertEquals(0, date_string_to_second("a")) - self.assertEquals(0, date_string_to_second("1:1:1")) - self.assertEquals(0, date_string_to_second("00:00:61")) - self.assertEquals(0, date_string_to_second("00:61:00")) - self.assertEquals(0, date_string_to_second("24:00:00")) - self.assertEquals(0, date_string_to_second("00:00:00")) - self.assertEquals(1, date_string_to_second("00:00:01")) - self.assertEquals(60, date_string_to_second("00:01:00")) - self.assertEquals(3600, date_string_to_second("01:00:00")) - self.assertEquals(3661, date_string_to_second("01:01:01")) - self.assertEquals(86399, date_string_to_second("23:59:59")) + self.assertEqual(0, date_string_to_second("a")) + self.assertEqual(0, date_string_to_second("1:1:1")) + self.assertEqual(0, date_string_to_second("00:00:61")) + self.assertEqual(0, date_string_to_second("00:61:00")) + self.assertEqual(0, date_string_to_second("24:00:00")) + self.assertEqual(0, date_string_to_second("00:00:00")) + self.assertEqual(1, date_string_to_second("00:00:01")) + self.assertEqual(60, date_string_to_second("00:01:00")) + self.assertEqual(3600, date_string_to_second("01:00:00")) + self.assertEqual(3661, date_string_to_second("01:01:01")) + self.assertEqual(86399, date_string_to_second("23:59:59")) print(" ---> test_utils date_string_to_second ok") def test_get_event_id_and_broadcaster_id(self): diff --git a/pod/main/configuration.json b/pod/main/configuration.json index 1c9ea18efc..92f4cf7dc7 100644 --- a/pod/main/configuration.json +++ b/pod/main/configuration.json @@ -3126,7 +3126,7 @@ }, "settings": { "CELERY_BROKER_URL": { - "default_value": "redis://127.0.0.1:6379/5", + "default_value": "redis://redis.localhost:6379/5", "description": { "en": [ "" @@ -3251,7 +3251,7 @@ "", "Il faut renseigner l’url du redis sur lequel Celery", "va chercher les ordres d’encodage et de transcription", - "par exemple : \"redis://redis:6379/7\"" + "par exemple : \"redis://redis.localhost:6379/7\"" ] }, "pod_version_end": "", @@ -3421,7 +3421,7 @@ "pod_version_init": "3.1.0" }, "ES_URL": { - "default_value": "[\"http://127.0.0.1:9200/\"]", + "default_value": "[\"http://elasticsearch.localhost:9200/\"]", "description": { "en": [ "" @@ -4308,7 +4308,7 @@ "pod_version_init": "3.1" }, "ALLOWED_HOSTS": { - "default_value": "['localhost']", + "default_value": "['pod.localhost']", "description": { "en": [ "" @@ -4351,7 +4351,7 @@ " # },", " \"default\": {", " \"BACKEND\": \"django_redis.cache.RedisCache\",", - " \"LOCATION\": \"redis://127.0.0.1:6379/1\",", + " \"LOCATION\": \"redis://redis.localhost:6379/1\",", " \"OPTIONS\": {", " \"CLIENT_CLASS\": \"django_redis.client.DefaultClient\",", " },", @@ -4359,7 +4359,7 @@ " # Persistent cache setup for select2 (NOT DummyCache or LocMemCache).", " \"select2\": {", " \"BACKEND\": \"django_redis.cache.RedisCache\",", - " \"LOCATION\": \"redis://127.0.0.1:6379/2\",", + " \"LOCATION\": \"redis://redis.localhost:6379/2\",", " \"OPTIONS\": {", " \"CLIENT_CLASS\": \"django_redis.client.DefaultClient\",", " },", diff --git a/pod/main/fixtures/initial_data.json b/pod/main/fixtures/initial_data.json index 7c66cd5217..62691b1daa 100644 --- a/pod/main/fixtures/initial_data.json +++ b/pod/main/fixtures/initial_data.json @@ -3,8 +3,8 @@ "model": "sites.site", "pk": 1, "fields": { - "domain": "localhost:8000", - "name": "localhost:8000" + "domain": "pod.localhost:8000", + "name": "pod.localhost:8000" } }, { diff --git a/pod/main/settings.py b/pod/main/settings.py index e85699ec49..a48467d8a4 100644 --- a/pod/main/settings.py +++ b/pod/main/settings.py @@ -48,7 +48,7 @@ # that this Django site is allowed to serve. # # https://docs.djangoproject.com/en/3.2/ref/settings/#allowed-hosts -ALLOWED_HOSTS = ["localhost"] +ALLOWED_HOSTS = ["pod.localhost"] ## # Session settings diff --git a/pod/main/test_settings.py b/pod/main/test_settings.py index 1fec93e3e9..c5d0473027 100644 --- a/pod/main/test_settings.py +++ b/pod/main/test_settings.py @@ -21,12 +21,14 @@ ) USE_DOCKER = True path = "pod/custom/settings_local.py" -ES_URL = ["http://127.0.0.1:9200/"] +ES_URL = ["http://elasticsearch.localhost:9200/"] ES_VERSION = 6 if os.path.exists(path): _temp = __import__("pod.custom", globals(), locals(), ["settings_local"]) USE_DOCKER = getattr(_temp.settings_local, "USE_DOCKER", True) - ES_URL = getattr(_temp.settings_local, "ES_URL", ["http://127.0.0.1:9200/"]) + ES_URL = getattr( + _temp.settings_local, "ES_URL", ["http://elasticsearch.localhost:9200/"] + ) ES_VERSION = getattr(_temp.settings_local, "ES_VERSION", 6) for application in INSTALLED_APPS: diff --git a/pod/main/tests/test_models.py b/pod/main/tests/test_models.py index 69a173d842..f1964745c9 100644 --- a/pod/main/tests/test_models.py +++ b/pod/main/tests/test_models.py @@ -110,7 +110,7 @@ def test_attributs(self): def test_delete_object(self): Configuration.objects.filter(key="maintenance_mode").delete() - self.assertEquals(Configuration.objects.filter(key="maintenance_mode").count(), 0) + self.assertEqual(Configuration.objects.filter(key="maintenance_mode").count(), 0) print("---> test_delete_object of ConfigurationTestCase: OK!") @@ -140,7 +140,7 @@ def test_attributs(self): def test_delete_object(self): AdditionalChannelTab.objects.filter(name="Tab0").delete() - self.assertEquals(AdditionalChannelTab.objects.filter(name="Tab0").count(), 0) + self.assertEqual(AdditionalChannelTab.objects.filter(name="Tab0").count(), 0) print("---> test_delete_object of AdditionalChannelTabTestCase: OK!") diff --git a/pod/main/tests/test_views.py b/pod/main/tests/test_views.py index 99901c1869..f2be6aeb5c 100644 --- a/pod/main/tests/test_views.py +++ b/pod/main/tests/test_views.py @@ -86,14 +86,14 @@ def test_contact_us(self) -> None: "description": "pod", "captcha_0": captcha.hashkey, "captcha_1": captcha.response, - "url_referrer": "http://localhost:8000/", + "url_referrer": "http://pod.localhost:8000/", "firstname": "", }, ) messages = list(response.wsgi_request._messages) self.assertEqual(len(messages), 1) self.assertEqual(str(messages[0]), _("Your message has been sent.")) - self.assertRedirects(response, "http://localhost:8000/") + self.assertRedirects(response, "http://pod.localhost:8000/") print(" ---> test_contact_us of mainViewsTestCase: OK!") # Form is not valid # /!\ voir fonction clean de ContactUsForm segment if diff --git a/pod/meeting/tests/test_views.py b/pod/meeting/tests/test_views.py index 5cdcaaf0f2..7771d765cb 100644 --- a/pod/meeting/tests/test_views.py +++ b/pod/meeting/tests/test_views.py @@ -68,7 +68,7 @@ def test_meeting_TestView_get_request_restrict(self): self.user = User.objects.get(username="pod") self.client.force_login(self.user) response = self.client.get(url) - self.assertEquals(response.context["access_not_allowed"], True) + self.assertEqual(response.context["access_not_allowed"], True) self.user.is_staff = True self.user.save() response = self.client.get(url) diff --git a/pod/recorder/tests/test_views.py b/pod/recorder/tests/test_views.py index 1171036e27..1a1ca97f20 100644 --- a/pod/recorder/tests/test_views.py +++ b/pod/recorder/tests/test_views.py @@ -236,7 +236,7 @@ def test_StudioPodTestView_get_request_restrict(self): self.user = User.objects.get(username="pod") self.client.force_login(self.user) response = self.client.get(url) - self.assertEquals(response.context["access_not_allowed"], True) + self.assertEqual(response.context["access_not_allowed"], True) self.user.is_staff = True self.user.save() response = self.client.get(url) diff --git a/pod/settings.py b/pod/settings.py index 3810e3f9a5..fdaf48e30e 100644 --- a/pod/settings.py +++ b/pod/settings.py @@ -13,7 +13,7 @@ ## # Version of the project # -VERSION = "3.6.1" +VERSION = "3.7.0" ## # Installed applications list @@ -356,7 +356,7 @@ CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://127.0.0.1:6379/3", + "LOCATION": "redis://redis.localhost:6379/3", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", }, @@ -364,7 +364,7 @@ }, "select2": { "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://127.0.0.1:6379/2", + "LOCATION": "redis://redis.localhost:6379/2", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", }, @@ -372,7 +372,7 @@ } SESSION_ENGINE = "redis_sessions.session" SESSION_REDIS = { - "host": "127.0.0.1", + "host": "redis.localhost", "port": 6379, "db": 4, "prefix": "session", diff --git a/pod/video/tests/test_models.py b/pod/video/tests/test_models.py index bdfbcfe548..6925444c04 100644 --- a/pod/video/tests/test_models.py +++ b/pod/video/tests/test_models.py @@ -221,7 +221,7 @@ def test_Type_with_attributs(self) -> None: def test_delete_object(self) -> None: """Test delete object.""" Type.objects.get(id=1).delete() - self.assertEquals(Type.objects.all().count(), 0) + self.assertEqual(Type.objects.all().count(), 0) print(" ---> test_delete_object of TypeTestCase: OK!") diff --git a/pod/video/tests/test_views.py b/pod/video/tests/test_views.py index 7f0b3f988d..d9c398f445 100644 --- a/pod/video/tests/test_views.py +++ b/pod/video/tests/test_views.py @@ -880,7 +880,7 @@ def test_video_edit_post_request(self) -> None: self.assertTrue(b"The changes have been saved." in response.content) v = Video.objects.get(title="VideoTest1") p = re.compile(r"^videos/([\d\w]+)/file([_\d\w]*).mp4$") - self.assertRegexpMatches(v.video.name, p) + self.assertRegex(v.video.name, p) # new one videofile = SimpleUploadedFile( "file.mp4", b"file_content", content_type="video/mp4" diff --git a/pod/video/views.py b/pod/video/views.py index e0363e6978..f2586e9a02 100644 --- a/pod/video/views.py +++ b/pod/video/views.py @@ -933,7 +933,7 @@ def owner_is_searchable(user: User) -> bool: def videos(request): """Render the main list of videos.""" videos_list = get_filtered_videos_list(request, get_available_videos()) - sort_field = request.GET.get("sort") if request.GET.get("sort") else "title" + sort_field = request.GET.get("sort") if request.GET.get("sort") else "date_added" sort_direction = request.GET.get("sort_direction") videos_list = sort_videos_list(videos_list, sort_field, sort_direction) diff --git a/pod/video_search/management/commands/create_pod_index.py b/pod/video_search/management/commands/create_pod_index.py index a697bc3676..405850e553 100644 --- a/pod/video_search/management/commands/create_pod_index.py +++ b/pod/video_search/management/commands/create_pod_index.py @@ -8,7 +8,7 @@ logger = logging.getLogger(__name__) -ES_URL = getattr(settings, "ES_URL", ["http://127.0.0.1:9200/"]) +ES_URL = getattr(settings, "ES_URL", ["http://elasticsearch.localhost:9200/"]) class Command(BaseCommand): diff --git a/pod/video_search/models.py b/pod/video_search/models.py index fb44955681..0b97220f63 100644 --- a/pod/video_search/models.py +++ b/pod/video_search/models.py @@ -8,7 +8,7 @@ import threading -ES_URL = getattr(settings, "ES_URL", ["http://127.0.0.1:9200/"]) +ES_URL = getattr(settings, "ES_URL", ["http://elasticsearch.localhost:9200/"]) # do it with contributor, overlay, chapter etc. diff --git a/pod/video_search/readme b/pod/video_search/readme index 81f2760d83..626b0c74c5 100644 --- a/pod/video_search/readme +++ b/pod/video_search/readme @@ -6,10 +6,10 @@ Configuration $>root@Pod:/etc/elasticsearch# vim elasticsearch.yml - cluster.name: pod-application - node.name: pod-1 - - discovery.zen.ping.unicast.hosts: ["127.0.0.1"] + - discovery.zen.ping.unicast.hosts: ["elasticsearch.localhost"] ?? Use Cerebro: https://github.com/lmenezes/cerebro To create pod index: (django_pod) pod@Pod:~/django_projects/podv3$ python manage.py create_pod_index To delete pod index: -$>curl -XDELETE 127.0.0.1:9200/pod \ No newline at end of file +$>curl -XDELETE elasticsearch.localhost:9200/pod diff --git a/pod/video_search/utils.py b/pod/video_search/utils.py index c4fadc27d3..270857ed3c 100644 --- a/pod/video_search/utils.py +++ b/pod/video_search/utils.py @@ -12,7 +12,7 @@ DEBUG = getattr(settings, "DEBUG", False) -ES_URL = getattr(settings, "ES_URL", ["http://127.0.0.1:9200/"]) +ES_URL = getattr(settings, "ES_URL", ["http://elasticsearch.localhost:9200/"]) ES_INDEX = getattr(settings, "ES_INDEX", "pod") ES_TIMEOUT = getattr(settings, "ES_TIMEOUT", 30) ES_MAX_RETRIES = getattr(settings, "ES_MAX_RETRIES", 10) diff --git a/pod/video_search/views.py b/pod/video_search/views.py index 721696155e..782ddc7e7b 100644 --- a/pod/video_search/views.py +++ b/pod/video_search/views.py @@ -11,7 +11,7 @@ # import json -ES_URL = getattr(settings, "ES_URL", ["http://127.0.0.1:9200/"]) +ES_URL = getattr(settings, "ES_URL", ["http://elasticsearch.localhost:9200/"]) ES_INDEX = getattr(settings, "ES_INDEX", "pod") ES_TIMEOUT = getattr(settings, "ES_TIMEOUT", 30) ES_MAX_RETRIES = getattr(settings, "ES_MAX_RETRIES", 10)