From 623934438ff6e81bc9504b7346010dc60e12f0b2 Mon Sep 17 00:00:00 2001 From: Anatoly Date: Fri, 1 Nov 2019 12:00:51 +0300 Subject: [PATCH 1/5] fixed svg path --- apps/utils/methods.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/utils/methods.py b/apps/utils/methods.py index bea8fec7..28ac55df 100644 --- a/apps/utils/methods.py +++ b/apps/utils/methods.py @@ -64,7 +64,7 @@ def image_path(instance, filename): def svg_image_path(instance, filename): """Determine SVG path method.""" filename = '%s.svg' % generate_code() - return 'image/svg/%s/%s/%s' % ( + return 'svg/%s/%s/%s' % ( instance._meta.model_name, datetime.now().strftime(settings.REST_DATE_FORMAT), filename) From 0352615200b122bc23ff9df4c35cb32c345feae0 Mon Sep 17 00:00:00 2001 From: littlewolf Date: Fri, 1 Nov 2019 12:12:51 +0300 Subject: [PATCH 2/5] Fix country_code svg --- apps/location/transfer_data.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/location/transfer_data.py b/apps/location/transfer_data.py index 2b0c15c8..5be39b7a 100644 --- a/apps/location/transfer_data.py +++ b/apps/location/transfer_data.py @@ -1,11 +1,11 @@ -from django.db.models import Q, QuerySet - from transfer.serializers.location import CountrySerializer, RegionSerializer, \ CitySerializer, AddressSerializer, \ Country from transfer.models import Cities, Locations from pprint import pprint +from requests import get + def transfer_countries(): queryset = Cities.objects.raw("""SELECT cities.id, cities.country_code_2 @@ -116,10 +116,14 @@ def transfer_addresses(): def update_flags(): queryset = Country.objects.only("id", "code", "svg_image").filter(old_id__isnull=False) + link_to_request = "https://s3.eu-central-1.amazonaws.com/gm-test.com/media" for query in queryset: - query.svg_image = f"/image/image/10-31-2019/{query.code}.svg" - query.save() + svg_link = f"/svg/country/10-31-2019/{query.code}.svg" + resp = get(f"{link_to_request}{svg_link}") + if resp.status_code == 200: + query.svg_image = svg_link + query.save() data_types = { From e4c9d8f9bce7259ea50280a97ba9f2323947d20f Mon Sep 17 00:00:00 2001 From: Dmitriy Kuzmenko Date: Fri, 1 Nov 2019 12:30:07 +0300 Subject: [PATCH 3/5] fix develop settings --- project/settings/development.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/project/settings/development.py b/project/settings/development.py index a9cfe5be..16965e22 100644 --- a/project/settings/development.py +++ b/project/settings/development.py @@ -60,4 +60,6 @@ DATABASES = { 'USER': os.environ.get('MYSQL_USER'), 'PASSWORD': os.environ.get('MYSQL_PASSWORD') } -} \ No newline at end of file +} + +BROKER_URL = 'redis://localhost:6379/1' \ No newline at end of file From 8d8cd09d64754dca3d55d5590ab98d821d158d95 Mon Sep 17 00:00:00 2001 From: Dmitriy Kuzmenko Date: Fri, 1 Nov 2019 12:32:48 +0300 Subject: [PATCH 4/5] fix develop settings --- project/settings/development.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/project/settings/development.py b/project/settings/development.py index 16965e22..3472e544 100644 --- a/project/settings/development.py +++ b/project/settings/development.py @@ -62,4 +62,6 @@ DATABASES = { } } -BROKER_URL = 'redis://localhost:6379/1' \ No newline at end of file +BROKER_URL = 'redis://redis:6379/1' +CELERY_RESULT_BACKEND = BROKER_URL +CELERY_BROKER_URL = BROKER_URL \ No newline at end of file From 11f091c069c453d03c3edfd9b7e4ff952f2d5542 Mon Sep 17 00:00:00 2001 From: Dmitriy Kuzmenko Date: Fri, 1 Nov 2019 12:36:53 +0300 Subject: [PATCH 5/5] fix develop settings --- project/settings/development.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/settings/development.py b/project/settings/development.py index 3472e544..a6f45b2f 100644 --- a/project/settings/development.py +++ b/project/settings/development.py @@ -62,6 +62,6 @@ DATABASES = { } } -BROKER_URL = 'redis://redis:6379/1' +BROKER_URL = 'redis://localhost:6379/1' CELERY_RESULT_BACKEND = BROKER_URL CELERY_BROKER_URL = BROKER_URL \ No newline at end of file