From a039510d7f9f8fe68b0ad4f199240961ae46cb81 Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Wed, 11 Sep 2019 09:00:12 +0200 Subject: [PATCH 01/16] Server configuration --- Makefile | 1 - .../group_vars/webservers/vault.yaml | 75 +++++++++++-------- ansible/roles/web/templates/docker-compose.j2 | 50 ++++++------- 3 files changed, 69 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile index c848c6d..bc3edc0 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,6 @@ logs: docker-compose logs -f --tail=500 backup: - docker-compose start postgres docker-compose exec web ./manage.py dumpdata --natural-foreign -e auth.permission -e contenttypes -e wagtailcore.GroupCollectionPermission -e wagtailimages.rendition -e sessions -e feedler.feedlysettings > ~/publichealth.home.json zip ~/publichealth.home.json.`date +"%d%m%Y-%H%M"`.zip ~/publichealth.home.json rm ~/publichealth.home.json diff --git a/ansible/inventories/production/group_vars/webservers/vault.yaml b/ansible/inventories/production/group_vars/webservers/vault.yaml index aa7ab1e..d720ba8 100644 --- a/ansible/inventories/production/group_vars/webservers/vault.yaml +++ b/ansible/inventories/production/group_vars/webservers/vault.yaml @@ -1,32 +1,45 @@ $ANSIBLE_VAULT;1.1;AES256 -39613133383630663164333437633037383936663266623861313565663964346232643666653332 -6165666665373661643663323337656163373631366135620a663164653335333166333865383139 -34633364623536663564363536333737316638353266316261393530386330633963336233346336 -6336383237646233630a656337626566373165313264386438636230646438353131623663666236 -62633739623431656535383166343862646133396630306264636563643536373562363163316135 -38373966323162653330316135333333643637323732663530336432383066316636303231653534 -37333765313830646662663761376266386262323437373230333231616162393961396162383732 -62633431343062316365316361343432373261623439656533393331383735646639646662653133 -36303039383339353961336664343436653066626561393761383733656664663939333233396134 -63393361396334666330376362643732326266336263393730623464333436336436313639613635 -64646237333739373137356262373666356631356632323466383363356366366366666330646230 -63386232663430386139393864626333326331323031313231346630326133353137373565326538 -36633032653637316531353131653235613331333436316365316661313835373563646534353239 -38623338373365623066613832623836626135326235623538396538366663306365666135633264 -34306464663230616538343539653663326339333437303762323066343933326634633530653565 -34663963353562363132396338623435646165393431303364623834636266373164663933633339 -32346536363330303539373461376631613863656366646437343165633464623064396231346137 -30643261346465303137306161613036336339326530306162393165363766353839316262363263 -38303236633436323830356461653234666534646363336463313064386230663763323632313563 -35396233363933333463326333633737333962353830336135386339613564343237363932306362 -31333535376630363739653433663865366566356132633032666562653234373938633031323139 -61306539376464666664316461303966613231646136623937643965326139303461616366333631 -39323638633661623064623334333864633235646131353237663361343839303537306261656131 -66656331316264636261643165643861376330633035386165626166313133376538656166353136 -31303433633134323532646132386130616431383065363832326533653535663763623733353764 -63383061653062353263383739643366363763363635663165353761623832366139643065396565 -31363435613761623538383237346431613335346437616538643462316665656337343832633937 -33663266663163306461626462626132613961626238333538666233613934346631346231363833 -36633138656563643262393764663331333237386164626230383562396663336564663134356632 -39386137343662666166326131363633353536326130396361376138363132363861313832303262 -326364356331366330393435346330373561 +30626232643339383163393232623961623366323463316261386261306433396537353264656535 +3762363861393739636564646263396137323534346666640a646433303864656633356266613966 +30356634336230656138396437653034643239643966343866316334343536646264343437346539 +3734343734313934330a333663333635353230646431343566636432306364336565643864346162 +34393531616636323035666438366461323437316538626539366539333837633363636139353261 +30613332396333613938346563323131323463653331356135383466626362373734336464633033 +37326465363236663834323936386237346364393437353138393836653262656162343964633633 +66333165346562376531663637656135366135663562656436386330636436303164363430336631 +30663935386363326337646461636362383936316461336562356232383034633764623264373161 +63343662643834333464376161666532663639663835633031333562653064333039376132323139 +36373336373161346332343531626130313039303066323364613139636334356131346662353532 +34323032656132363734653466643566646463323163393330396265373638663564643337303431 +37363039306539613839643061326633363764616237353538663432626631336365343463653737 +36316166346337646430373865353433346633646533313762626530646237353730653365663035 +63383366303266626430646639396636343239656636653061383637306437303533383062313135 +34323066633535613562393961303134306131306430343836613565343934323761353066386561 +61646231383433396430323335343530396333346431356134393339306262393933653934663435 +66383730373633326330373239313235643634313737313935666538353432363233366538626634 +66346535313762646132316561393234666565633839306264323565333738663763376563653264 +36666631663335343837376530633337363636663639623937343930313932323765363463626631 +35646436363232323661613761646231353862383736336262616364303861636465366364633762 +37373966363166633739646165333738346534353633313039356336626161323236346436393064 +37323132613836336237373364333032373435666334623436386335613038303632333435336236 +34313039633831326562623135646265383737323361353764616230636464343363306431376531 +38646635353835633032393863333836633963366361383238616239376437303136626238373736 +30333966396431393161386665373432333934646136313735616436353363616532613963353535 +31653338383538323439666264393539646663646435353838636231343336636666323165663736 +39316632353632363232326463666566316437396262316430336538346633663432343330383465 +63393463333034383966343238373964653631643465353163323531356231623130303831643431 +64623037396337613536666361336231333262396434346130633134333434626433633861306364 +37646233643832356162386438373638363831663331656638363165663262383662363965376464 +33323666613564343136643734656131646130623061323966326665373239383966383665373931 +64306361336534363863303463306163376661323633333030656432313536376462633663343162 +34303938633233386164336161366266633334643665626461353134633662326134383061653231 +35646430346239326233666432343034373936316433326164633035356337613864376235646235 +33616631393432366437343630666566316664386261393463646666653264353862633537303038 +61346434376561376233343863383239326564363263313438666235653436303062353334316634 +63653262373533633066336338326235393439643264383163336139316166613462623131396138 +31303937393432613732306235393738633732643464646131653230653736613539653034643561 +33396436366235306138373662636238356331663833303462623263306538386461613038363565 +65303130343761376461356239326333616139643133626637323033333466666163666136313233 +30636430313662383635346561643433343137303631646134313563663330643635643633333334 +33653261613361383534356563333962366136383734623366616662326661333539613163343738 +61356234373935316665 diff --git a/ansible/roles/web/templates/docker-compose.j2 b/ansible/roles/web/templates/docker-compose.j2 index 20600bf..5057364 100644 --- a/ansible/roles/web/templates/docker-compose.j2 +++ b/ansible/roles/web/templates/docker-compose.j2 @@ -5,10 +5,10 @@ web: volumes: - ./:/usr/src/app - {{ django_log_dir }}:/var/log/wagtail - links: - - redis - - postgres - - elasticsearch + #links: + # - redis + # - postgres + # - elasticsearch ports: - "5000:5000" environment: @@ -19,25 +19,25 @@ web: - MAILGUN_DOMAIN={{ django_email_domain }} - MAILGUN_FROM={{ django_email_from }} - DATABASE_URL={{ django_postgres_url }} - - ELASTICSEARCH_URL=http://elasticsearch:9200 - - REDIS_URL=redis://redis:6379 + - REDIS_URL={{ django_redis_url }} + - ELASTICSEARCH_URL={{ django_elasticsearch_url }} - LOG_DIR=/var/log/wagtail -redis: - image: redis - command: ["redis-server", "--appendonly", "yes"] - restart: on-failure - volumes: - - {{ redis_data_dir }}:/data - ports: - - "6379:6379" -postgres: - image: postgres - ports: - - "5432:5432" -elasticsearch: - image: elasticsearch:5 - ports: - - "9200:9200" - environment: - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - mem_limit: 1g +# elasticsearch: +# image: elasticsearch:5 +# ports: +# - "9200:9200" +# environment: +# - "ES_JAVA_OPTS=-Xms512m -Xmx512m" +# mem_limit: 1g +# redis: +# image: redis +# command: ["redis-server", "--appendonly", "yes"] +# restart: on-failure +# volumes: +# - {{ redis_data_dir }}:/data +# ports: +# - "6379:6379" +# postgres: +# image: postgres +# ports: +# - "5432:5432" From eb743bca9c1676a1b7e8bffdf9fd9e920377af5b Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Wed, 11 Sep 2019 09:02:11 +0200 Subject: [PATCH 02/16] Updated vars --- .../inventories/production/group_vars/webservers/vars.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ansible/inventories/production/group_vars/webservers/vars.yaml b/ansible/inventories/production/group_vars/webservers/vars.yaml index 9bb422c..ef08c51 100644 --- a/ansible/inventories/production/group_vars/webservers/vars.yaml +++ b/ansible/inventories/production/group_vars/webservers/vars.yaml @@ -21,3 +21,9 @@ django_secret_key: "{{ vault_django_secret_key }}" # Default: postgres://postgres:@postgres:5432/postgres django_postgres_url: "{{ vault_django_postgres_url }}" + +# Default: http://elasticsearch:9200 +django_elasticsearch_url: "{{ vault_django_elasticsearch_url }}" + +# Default: redis://redis:6379 +django_redis_url: "{{ vault_django_redis_url }}" From 00d21c840e37ae390808528f9d3eba71fdaeee9d Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Wed, 11 Sep 2019 23:45:37 +0200 Subject: [PATCH 03/16] Disable Draftail due to wagtail#4602 --- feedler/management/commands/invalidpage.py | 31 ++++++++++++++++++++++ publichealth/settings/base.py | 8 +++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 feedler/management/commands/invalidpage.py diff --git a/feedler/management/commands/invalidpage.py b/feedler/management/commands/invalidpage.py new file mode 100644 index 0000000..474df36 --- /dev/null +++ b/feedler/management/commands/invalidpage.py @@ -0,0 +1,31 @@ +from django.core.management.base import BaseCommand +from django.contrib.auth.models import User +from django.test import Client + +from wagtail.core.models import Page +from wagtail.admin.views.pages import edit + +# Scans for broken editors, via +# https://github.com/wagtail/wagtail/issues/4602 + +class Command(BaseCommand): + + def handle(self, **options): + invalid_page_ids = [] + pages = Page.objects.all() + client = Client() + # use any existing super user account + user = User.objects.get(username='oleg') + client.force_login(user) + + for page in pages: + id = page.id + # print statement to assure the script is running + print(id) + url = f'/cms/pages/{id}/edit/' + try: + response = client.get(url) + except: + invalid_pages.append(id) + + print(invalid_page_ids) diff --git a/publichealth/settings/base.py b/publichealth/settings/base.py index 7e5470b..01d7518 100644 --- a/publichealth/settings/base.py +++ b/publichealth/settings/base.py @@ -43,7 +43,7 @@ INSTALLED_APPS = [ 'wagtail.contrib.forms', 'wagtail.contrib.redirects', 'wagtail.contrib.search_promotions', - + 'wagtail.embeds', 'wagtail.sites', 'wagtail.users', @@ -198,6 +198,12 @@ COMPRESS_PRECOMPILERS = [ WAGTAIL_SITE_NAME = "Public Health Schweiz" +WAGTAILADMIN_RICH_TEXT_EDITORS = { + 'default': { + 'WIDGET': 'wagtail.admin.rich_text.HalloRichTextArea' + } +} + # Puput settings PUPUT_AS_PLUGIN = True From 8379996dc525db8a3ec7e5ba308ae7f2f89e8045 Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Wed, 11 Sep 2019 23:45:47 +0200 Subject: [PATCH 04/16] Fix ansible join --- ansible/roles/web/templates/docker-compose.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/web/templates/docker-compose.j2 b/ansible/roles/web/templates/docker-compose.j2 index 5057364..8af9226 100644 --- a/ansible/roles/web/templates/docker-compose.j2 +++ b/ansible/roles/web/templates/docker-compose.j2 @@ -13,7 +13,7 @@ web: - "5000:5000" environment: - DJANGO_SETTINGS_MODULE={{ django_project_name }}.settings.production - - ALLOWED_HOSTS=www.{{ allowed_domains|join(',www.') }},{{ allowed_domains }},{{ ipv4_addresses|join(':5000,') }} + - ALLOWED_HOSTS=www.{{ allowed_domains|split(',')|join(',www.') }},{{ allowed_domains }},{{ ipv4_addresses|join(':5000,') }} - SECRET_KEY={{ django_secret_key }} - MAILGUN_KEY={{ django_email_key }} - MAILGUN_DOMAIN={{ django_email_domain }} From 11b685d004b82dc37f45b8ce24bf84aaff3555f2 Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Wed, 11 Sep 2019 23:49:46 +0200 Subject: [PATCH 05/16] Fix ansible join --- .../group_vars/webservers/vault.yaml | 89 ++++++++++--------- ansible/roles/web/templates/docker-compose.j2 | 2 +- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/ansible/inventories/production/group_vars/webservers/vault.yaml b/ansible/inventories/production/group_vars/webservers/vault.yaml index d720ba8..a8c6263 100644 --- a/ansible/inventories/production/group_vars/webservers/vault.yaml +++ b/ansible/inventories/production/group_vars/webservers/vault.yaml @@ -1,45 +1,46 @@ $ANSIBLE_VAULT;1.1;AES256 -30626232643339383163393232623961623366323463316261386261306433396537353264656535 -3762363861393739636564646263396137323534346666640a646433303864656633356266613966 -30356634336230656138396437653034643239643966343866316334343536646264343437346539 -3734343734313934330a333663333635353230646431343566636432306364336565643864346162 -34393531616636323035666438366461323437316538626539366539333837633363636139353261 -30613332396333613938346563323131323463653331356135383466626362373734336464633033 -37326465363236663834323936386237346364393437353138393836653262656162343964633633 -66333165346562376531663637656135366135663562656436386330636436303164363430336631 -30663935386363326337646461636362383936316461336562356232383034633764623264373161 -63343662643834333464376161666532663639663835633031333562653064333039376132323139 -36373336373161346332343531626130313039303066323364613139636334356131346662353532 -34323032656132363734653466643566646463323163393330396265373638663564643337303431 -37363039306539613839643061326633363764616237353538663432626631336365343463653737 -36316166346337646430373865353433346633646533313762626530646237353730653365663035 -63383366303266626430646639396636343239656636653061383637306437303533383062313135 -34323066633535613562393961303134306131306430343836613565343934323761353066386561 -61646231383433396430323335343530396333346431356134393339306262393933653934663435 -66383730373633326330373239313235643634313737313935666538353432363233366538626634 -66346535313762646132316561393234666565633839306264323565333738663763376563653264 -36666631663335343837376530633337363636663639623937343930313932323765363463626631 -35646436363232323661613761646231353862383736336262616364303861636465366364633762 -37373966363166633739646165333738346534353633313039356336626161323236346436393064 -37323132613836336237373364333032373435666334623436386335613038303632333435336236 -34313039633831326562623135646265383737323361353764616230636464343363306431376531 -38646635353835633032393863333836633963366361383238616239376437303136626238373736 -30333966396431393161386665373432333934646136313735616436353363616532613963353535 -31653338383538323439666264393539646663646435353838636231343336636666323165663736 -39316632353632363232326463666566316437396262316430336538346633663432343330383465 -63393463333034383966343238373964653631643465353163323531356231623130303831643431 -64623037396337613536666361336231333262396434346130633134333434626433633861306364 -37646233643832356162386438373638363831663331656638363165663262383662363965376464 -33323666613564343136643734656131646130623061323966326665373239383966383665373931 -64306361336534363863303463306163376661323633333030656432313536376462633663343162 -34303938633233386164336161366266633334643665626461353134633662326134383061653231 -35646430346239326233666432343034373936316433326164633035356337613864376235646235 -33616631393432366437343630666566316664386261393463646666653264353862633537303038 -61346434376561376233343863383239326564363263313438666235653436303062353334316634 -63653262373533633066336338326235393439643264383163336139316166613462623131396138 -31303937393432613732306235393738633732643464646131653230653736613539653034643561 -33396436366235306138373662636238356331663833303462623263306538386461613038363565 -65303130343761376461356239326333616139643133626637323033333466666163666136313233 -30636430313662383635346561643433343137303631646134313563663330643635643633333334 -33653261613361383534356563333962366136383734623366616662326661333539613163343738 -61356234373935316665 +62393332303938353731313464363434396133656361393563356533646164393530363861353133 +6361336137393032356664343139313266313838303264630a356133333234343862366131363634 +64303338356232326263356166643231353839353766613531663434303230316362636639366330 +3062396137316165640a383861353138366265306463336434343530326631313136643036613135 +62323836356466633734373762333034336665386234363431373038353135333738616431633964 +39613635613136633930363532653433303232313264376166653166383262353535323831653666 +38333737326366323763653164396430656565643530653765323135386536623562666532646430 +32346534323265303036396339623638306233626330393839646266626164306132326138303661 +63653966386263353735623538326438323632313831373830323734346165313233373437623762 +39393962613531353732616439643561373034633933353930303464303633643239366264646339 +66633465626536376161393331663565386432316234303061626164323937326631633865646266 +36313737626365666632366430343032656531643763323437383132313834316166313264363335 +62343662353265646565343362343861396536343934376131363262643735353438383866636330 +30666631356163313264656262623733653639646635323563633138396432323737616437363035 +35396265626661616434383137666335653365386365396665386639326233383565373765306666 +35626264393734386534333566313463343662653430383062666534646466323937633162306431 +66383435313863313466663237323537316231636333623561663831663937306561336536313433 +65353466313130313365393639623262343632613131653232643131336661303365626330303161 +65323731383933363330303532663064656466353138313832653135383663616636386231333363 +39353839656361303530643630343233656131363665356137333937306435376638626365663564 +61646664323334306533633564383663666463393737633632303334636233336361326539376133 +32636539353334373731386237356264613065363261316432333164376430386663383065303535 +33333637346561353633303865353166646265623365636631396266366531623331316235666334 +65383666323839386538373232326139353533363432633237653363343965353136626534393036 +33383438643437613734623563303338346238336266643639366266303966633136396134316137 +64663236646639336162646366333832636263333530393731646639636363313364386662313237 +66353139636662633435616165663837333639616136656132363834643133386434653035613734 +30616361356339376566343265333861656239326662623031633039616639386637303566346566 +39663864363937336539643865633137663466333037363138343332383830666632323466623437 +63623763656238396537316532663164386164653930633866386634656562383863616432373130 +63643434316562303838376334336161306131346635363631303936336464653963353633383432 +35646635333262313235333231643238366534663833323635386366366637336665333830376535 +65633933663762363165376235663863663662326331396439353863623236363666653632396434 +35323630633736306231626637623436383863633239663230653565623762623932623034303436 +34613337643833323466303663386437363439626263636438306666646238623561323833386535 +37376663333035316231643139336436386332313835376434376634643731303837666165326463 +37653436366637363335333534653835343834326530643036373139383431633832323730356430 +31303939636137633539383633326637363830643263353939313562333532623139343630323836 +63613332643863646239353062363366303033326466653063613263623234383634333264336639 +63613763373638613332613335346161613339663062323662363864626430643936313039333038 +38303232613463646361666363653937633664336332636139636462666331633061663434623431 +31396661316632656232306661343936363161336636613964386632663939663638383566353030 +30396561393335613036613764363031636633653565333231623433383565323663376637653163 +36663530623133393262653132366161323461616366616530393732653731396166323834616561 +6535 diff --git a/ansible/roles/web/templates/docker-compose.j2 b/ansible/roles/web/templates/docker-compose.j2 index 8af9226..cc637a9 100644 --- a/ansible/roles/web/templates/docker-compose.j2 +++ b/ansible/roles/web/templates/docker-compose.j2 @@ -13,7 +13,7 @@ web: - "5000:5000" environment: - DJANGO_SETTINGS_MODULE={{ django_project_name }}.settings.production - - ALLOWED_HOSTS=www.{{ allowed_domains|split(',')|join(',www.') }},{{ allowed_domains }},{{ ipv4_addresses|join(':5000,') }} + - ALLOWED_HOSTS=www.{{ allowed_domains|join(',www.') }},{{ allowed_domains|join(',') }},{{ ipv4_addresses|join(':5000,') }} - SECRET_KEY={{ django_secret_key }} - MAILGUN_KEY={{ django_email_key }} - MAILGUN_DOMAIN={{ django_email_domain }} From 2d4cc65acdfb168a4eedc503fa9d831af5989f1e Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Thu, 12 Sep 2019 00:00:46 +0200 Subject: [PATCH 06/16] Fix ansible join --- .../group_vars/webservers/vault.yaml | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/ansible/inventories/production/group_vars/webservers/vault.yaml b/ansible/inventories/production/group_vars/webservers/vault.yaml index a8c6263..a7a353e 100644 --- a/ansible/inventories/production/group_vars/webservers/vault.yaml +++ b/ansible/inventories/production/group_vars/webservers/vault.yaml @@ -1,46 +1,46 @@ $ANSIBLE_VAULT;1.1;AES256 -62393332303938353731313464363434396133656361393563356533646164393530363861353133 -6361336137393032356664343139313266313838303264630a356133333234343862366131363634 -64303338356232326263356166643231353839353766613531663434303230316362636639366330 -3062396137316165640a383861353138366265306463336434343530326631313136643036613135 -62323836356466633734373762333034336665386234363431373038353135333738616431633964 -39613635613136633930363532653433303232313264376166653166383262353535323831653666 -38333737326366323763653164396430656565643530653765323135386536623562666532646430 -32346534323265303036396339623638306233626330393839646266626164306132326138303661 -63653966386263353735623538326438323632313831373830323734346165313233373437623762 -39393962613531353732616439643561373034633933353930303464303633643239366264646339 -66633465626536376161393331663565386432316234303061626164323937326631633865646266 -36313737626365666632366430343032656531643763323437383132313834316166313264363335 -62343662353265646565343362343861396536343934376131363262643735353438383866636330 -30666631356163313264656262623733653639646635323563633138396432323737616437363035 -35396265626661616434383137666335653365386365396665386639326233383565373765306666 -35626264393734386534333566313463343662653430383062666534646466323937633162306431 -66383435313863313466663237323537316231636333623561663831663937306561336536313433 -65353466313130313365393639623262343632613131653232643131336661303365626330303161 -65323731383933363330303532663064656466353138313832653135383663616636386231333363 -39353839656361303530643630343233656131363665356137333937306435376638626365663564 -61646664323334306533633564383663666463393737633632303334636233336361326539376133 -32636539353334373731386237356264613065363261316432333164376430386663383065303535 -33333637346561353633303865353166646265623365636631396266366531623331316235666334 -65383666323839386538373232326139353533363432633237653363343965353136626534393036 -33383438643437613734623563303338346238336266643639366266303966633136396134316137 -64663236646639336162646366333832636263333530393731646639636363313364386662313237 -66353139636662633435616165663837333639616136656132363834643133386434653035613734 -30616361356339376566343265333861656239326662623031633039616639386637303566346566 -39663864363937336539643865633137663466333037363138343332383830666632323466623437 -63623763656238396537316532663164386164653930633866386634656562383863616432373130 -63643434316562303838376334336161306131346635363631303936336464653963353633383432 -35646635333262313235333231643238366534663833323635386366366637336665333830376535 -65633933663762363165376235663863663662326331396439353863623236363666653632396434 -35323630633736306231626637623436383863633239663230653565623762623932623034303436 -34613337643833323466303663386437363439626263636438306666646238623561323833386535 -37376663333035316231643139336436386332313835376434376634643731303837666165326463 -37653436366637363335333534653835343834326530643036373139383431633832323730356430 -31303939636137633539383633326637363830643263353939313562333532623139343630323836 -63613332643863646239353062363366303033326466653063613263623234383634333264336639 -63613763373638613332613335346161613339663062323662363864626430643936313039333038 -38303232613463646361666363653937633664336332636139636462666331633061663434623431 -31396661316632656232306661343936363161336636613964386632663939663638383566353030 -30396561393335613036613764363031636633653565333231623433383565323663376637653163 -36663530623133393262653132366161323461616366616530393732653731396166323834616561 -6535 +31623061306338643731643236656264313365323238383734373466653131336263653365396337 +3864346638623236343833646264393366666230396662300a623038333531393836356163623731 +38633239636431653935633763316639383562366332346531316632616666346532326239313933 +6135323639373465300a343438306338653633633465363938363865333530343663383838653738 +62663439333565343565666434646438346566633933333863303361373166616339626630623930 +66646162353034623439653262386130656564613962373234633234346138386132323362323839 +66656533333537303165336634346666306436626236343561343336343135346665666539643232 +65613166373464373035373666646533316365383931623966353939393765343062306230363963 +34306538383064336137313034633764316130653536353035323030326533633431633866646463 +39376234373437313334386465623837613362666337326562396364626332356463313165653661 +32333266396261306565333061323138646531376639666264353366633033646366396634623863 +61653030353061656666326561613736356461363032333937623362363734656466323032303661 +35633635353638613632653639643232313932353232386531353737663436396531396334313837 +63633333393632356166656266643165373238333237363930333132643962636263346466366130 +62343731353939336330316363613238363136366436343732353762626263663736383863356365 +61343361303933346239323165353365626431623938326464396438316332633563663465653337 +63323862393063633965383932393930326266323237643839366231666166636265623637346264 +66326662363735373638343561643239626265643630356239653536623930313564316636303130 +65383661633130323138323330633161386138646564306636643835666333316535636665626464 +37663531646130376564346261363064323434373864663939353835376262346130393338303833 +63626539633332383930373862316237363966363566383735383162396165363662363764366530 +34646135353534306237393233383764376330313234323364363834623438363537386331343934 +63343464353862616339326565626134353661353134306431326666643635383165633964353936 +30646437616436363539346433646463666535303530653533653062376633306332366237373434 +32303964633532336430343662373731356365326366383431616631373132636136653539323037 +64366334386637623436316161613535636130363162363264663033623531633932623462343331 +31343232333064623063326666323038663839643439353166346366663934353565653433366362 +33363432383533663263663761633762366633363563623237636636386337626338653238386533 +33326632646562386134343138663937346464643733616339316162653566323865643633376537 +36343636396263353037316631333933313739316135343766666432373633363166373866333632 +62623734653863303566643331303462363137346233636130333830323333323863356538356139 +37303231663966623034323138666664326236626439383638666664363531303433636662666561 +39626265323136313037383164646636653265373832663931356237343138396638376135346636 +66666536616135386666666464303539616135333064636135346430383431303037393036353435 +65306131333532663038306136303930636661373764343736383364303266356330333661386635 +34666539636239656637353131333330346563386334306535643230353439623762343932303361 +65353163346535396563383862653963326261386531363934356266653461313437633661313035 +33643766613366643065663637663733363563663633393238623633653664386630376637643464 +61316135633961636337303735656365356437653730373965343933333433386132633061363064 +37376337356262613136633431343461333237333063623834616165643637366362393137373339 +37363430393939663734303364343064666533653363656633303966613334356363316436326438 +30336236343731656566656631323737346630363538663361303734613738303462366238386563 +31623135633062666566346561386438663031383232376562623533656437333665376439653932 +66373134303762356238323962343339386161333038353038393936306434643739396464323532 +3236 From ead009f3819059fd9d6e45fa4ac745ef8f603e58 Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Thu, 17 Oct 2019 17:05:01 +0200 Subject: [PATCH 07/16] Backup and nginx config --- Makefile | 7 +++- ansible/roles/web/templates/nginx.conf.j2 | 39 +++++++++++++---------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index bc3edc0..04c445c 100644 --- a/Makefile +++ b/Makefile @@ -69,13 +69,18 @@ django-shell: logs: docker-compose logs -f --tail=500 -backup: +backup-data: docker-compose exec web ./manage.py dumpdata --natural-foreign -e auth.permission -e contenttypes -e wagtailcore.GroupCollectionPermission -e wagtailimages.rendition -e sessions -e feedler.feedlysettings > ~/publichealth.home.json zip ~/publichealth.home.json.`date +"%d%m%Y-%H%M"`.zip ~/publichealth.home.json rm ~/publichealth.home.json + +backup-images: echo "Backing up images ..." + sudo chown -R ansible media zip -ruq ~/media.zip media +backup: backup-data backup-images + django-loaddata: gunzip ~/publichealth.home.json.gz docker-compose exec web ./manage.py loaddata ~/publichealth.home.json diff --git a/ansible/roles/web/templates/nginx.conf.j2 b/ansible/roles/web/templates/nginx.conf.j2 index 1533fc7..4493a4e 100644 --- a/ansible/roles/web/templates/nginx.conf.j2 +++ b/ansible/roles/web/templates/nginx.conf.j2 @@ -6,21 +6,14 @@ upstream wagtail-site { server localhost:5000; } server { - listen 80 default_server; server_name _; - - location / { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_redirect off; - proxy_pass http://wagtail-site; - } + listen 80 default_server; + return 301 https://$host$request_uri; } server { - listen 443 ssl default_server; server_name _; - + listen 443 ssl default_server; + ssl on; ssl_certificate /etc/certs/public-health.ch/cloudflare.pem; ssl_certificate_key /etc/certs/public-health.ch/cloudflare.key; @@ -39,7 +32,7 @@ server { access_log off; expires 36000; alias {{ release_dir }}/static/; add_header Cache-Control "public"; - add_header Access-Control-Allow-Origin https://{{ domain }}; + add_header Access-Control-Allow-Origin *; #https://{{ domain }}; } # Set a longer expiry for CACHE/, because the filenames are unique. @@ -54,18 +47,30 @@ server { alias {{ release_dir }}/static/images/favicon.ico; } - # Only serve /media/images by default, not e.g. original_images/. - location /media/images { - alias {{ release_dir }}/media/images; - access_log off; expires max; + # Directly serve media with max caching + location /media { + root {{ release_dir }}; + autoindex off; + access_log off; + expires max; add_header Cache-Control "public"; } + # Only serve media by default, not e.g. original_images/. + #location ~* ^/media { + # alias {{ release_dir }}/media; + #} + # Disable English home page (for now) - if ($host = 'public-health.ch') { + if ($host !~* 'sphc.ch') { rewrite ^/en/$ $scheme://$host/de/; } + # Redirect French home page as appropriate + if ($host = 'manifestesante.ch') { + rewrite ^/$ $scheme://$host/fr/; + } + location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; From 7c89dd3273a8a36dedbebf55262101cf9cb02aa3 Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Thu, 17 Oct 2019 17:42:27 +0200 Subject: [PATCH 08/16] Logo and color fields --- .../migrations/0027_auto_20191017_1715.py | 25 +++++++++++++++++++ publichealth/home/models/snippets.py | 12 +++++++++ .../home/templates/tags/contact_info.html | 20 +++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 publichealth/home/migrations/0027_auto_20191017_1715.py diff --git a/publichealth/home/migrations/0027_auto_20191017_1715.py b/publichealth/home/migrations/0027_auto_20191017_1715.py new file mode 100644 index 0000000..dc6e4e2 --- /dev/null +++ b/publichealth/home/migrations/0027_auto_20191017_1715.py @@ -0,0 +1,25 @@ +# Generated by Django 2.1.12 on 2019-10-17 15:15 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailimages', '0001_squashed_0021'), + ('home', '0026_auto_20190625_1521'), + ] + + operations = [ + migrations.AddField( + model_name='contact', + name='color', + field=models.CharField(blank=True, default='', max_length=40), + ), + migrations.AddField( + model_name='contact', + name='logo', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image'), + ), + ] diff --git a/publichealth/home/models/snippets.py b/publichealth/home/models/snippets.py index 1cb0037..16ce540 100644 --- a/publichealth/home/models/snippets.py +++ b/publichealth/home/models/snippets.py @@ -7,6 +7,7 @@ from django.db import models from wagtail.snippets.models import register_snippet from wagtail.core.models import Page +from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.admin.edit_handlers import FieldPanel, PageChooserPanel from .forms import ContactForm @@ -63,11 +64,20 @@ class Contact(models.Model): 'title_fr', 'title_en', ) + address = models.TextField(default="", blank=True) phone = models.CharField(max_length=40, blank=True, default="") email = models.EmailField(max_length=100, blank=True, default="") www = models.URLField(null=True, blank=True) + color = models.CharField(max_length=40, blank=True, default="") + logo = models.ForeignKey( + 'wagtailimages.Image', + null=True, blank=True, + on_delete=models.SET_NULL, + related_name='+' + ) + map_url = models.URLField(null=True, blank=True, help_text="Optional link of address to mapping provider") analytics = models.CharField(max_length=60, default="", blank=True, @@ -95,6 +105,8 @@ class Contact(models.Model): FieldPanel('phone'), FieldPanel('email'), FieldPanel('www'), + ImageChooserPanel('logo'), + FieldPanel('color'), FieldPanel('map_url'), FieldPanel('analytics'), PageChooserPanel('contact_form', 'home.ContactForm'), diff --git a/publichealth/home/templates/tags/contact_info.html b/publichealth/home/templates/tags/contact_info.html index 5019feb..bf63e6f 100644 --- a/publichealth/home/templates/tags/contact_info.html +++ b/publichealth/home/templates/tags/contact_info.html @@ -1,3 +1,5 @@ +{% load wagtailimages_tags %} +

{% if contact.map_url %} @@ -19,6 +21,24 @@ {% endfor %} + + {% if contact.is_google_analytics %} From 4efbdecdfcf5c073efad62d16535b16452cf5d1e Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Thu, 17 Oct 2019 17:42:31 +0200 Subject: [PATCH 09/16] Reqs update --- Pipfile.lock | 188 +++++++++++++++++++++++------------------------ requirements.txt | 10 +-- 2 files changed, 98 insertions(+), 100 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 9359b9d..31bed3f 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -24,10 +24,10 @@ }, "certifi": { "hashes": [ - "sha256:046832c04d4e752f37383b628bc601a7ea7211496b4638f6514d0e5b9acc4939", - "sha256:945e3ba63a0b9f577b1395204e13c3a231f9bc0223888be653286534e5873695" + "sha256:e4f3620cfea4f83eedc95b24abd9cd56f3c4b146dd0177e83a21b4eb49e21e50", + "sha256:fd7c7c74727ddcf00e9acd26bba8da604ffec95bf1c2144e67aff7a8b50e6cef" ], - "version": "==2019.6.16" + "version": "==2019.9.11" }, "chardet": { "hashes": [ @@ -73,11 +73,11 @@ }, "django": { "hashes": [ - "sha256:33e4bb3f3268ecc362a7bd982c7f19fff30597c749fedbc1fd3773ebb82ec38c", - "sha256:f4351f1f921bb6c3de03e24cdba823365fb9a79a44f607ba2560e9e3b7f16ff3" + "sha256:79c6cfbc76a4612efc8a80d0094b96f50cb2aa654b2b2b530a4e707fa2985b4b", + "sha256:7a28a4eb0167eba491ccfafd7006843b5cdd26d8c93b955a74c2ea74f94efc2c" ], "index": "pypi", - "version": "==2.1.12" + "version": "==2.1.13" }, "django-anymail": { "hashes": [ @@ -183,9 +183,9 @@ }, "draftjs-exporter": { "hashes": [ - "sha256:503f222c81de9a0619158d8f88b638f9069af8de233dc020faa782c7a3b22100" + "sha256:5839cbc29d7bce2fb99837a404ca40c3a07313f2a20e2700de7ad6aa9a9a18fb" ], - "version": "==2.1.6" + "version": "==2.1.7" }, "elasticsearch": { "hashes": [ @@ -232,56 +232,54 @@ }, "libsass": { "hashes": [ - "sha256:2457723fe04f4e690105f758aa125e809afc840812965095fa3f4edccd6275ef", - "sha256:2974772e7984b27a51a6d91ebc140183ddd574a9663bd02154ddfb75f13a3eed", - "sha256:2d067ce4f393fee2ce52bb810a364deac5454dfdb7945d31d1f4265f21f03ab8", - "sha256:57d0b99c4e3512233a44141f1bf852570d359724a606dfc4550eccd0f570460d", - "sha256:5b604e4f5befdecc76240c2ba243fd7e23c642ffc2dd86cbfd094a44ead6b08d", - "sha256:5dd647ffa1319a2a18572f41fee3bb561d7f77d8d4784074a00b2eb22c61a859", - "sha256:78f3f14e47612be4fa4b161278f2a3e880a19b6a3367f749e9ae240434b7e7f5", - "sha256:8d423e4b4c0e219488104b4ec4267688dbd816f3ae806beb4201918eff059b2d", - "sha256:a20473b0427d82e37fa68f0b3a8d219f0bb5ca6d3f7d93b0f5342219285e7064", - "sha256:c1f76c2a0993914f3c3088e9b6c7031f22e879c5d27a060cdc8c5aa1318eb9b6", - "sha256:c99fbc950f1955e8b6370aafdb9d84d324e4984a2e00a2b47f04dbcc3706a9d1", - "sha256:cb50f385117535f7671ac7ff3144c1ef0b8e088778c58d269ce6f31b87bfad72", - "sha256:f0f033a8154be60e1a2e1f79ee849ea69a1d62e5d476a78f69e4c7d8fd7c20e1", - "sha256:f2572b73b2e13e74b28388ae86c4fabb853ddbfc12279b4444243bd614710ce8", - "sha256:f8790db67e00c5bc7be1bdd81ed477563a4b191e839193ecc0c2c5ec679ec481" + "sha256:3113ef32eaf3662c162c250db6883d7a5f177856bfd8bb632a147cb0a95e4fee", + "sha256:312d135e6bd1a137927fed781dab497c05930305265e3d3b1da3b3d916cd97a6", + "sha256:32f8322aad9b6b864b826adb5e193d704d5fb2c816f85a5cc5bf775730e5d024", + "sha256:4252e24c8869d6ce764052f200445331d1881b5c2d283d6131a30d0684b10403", + "sha256:517324814f81cd2642cb1e9fd772e8e50e336c7c8833d50535a731e5b4c84606", + "sha256:607ce32c3b31542e0bf1bc2409627dd7247a3849ba720ec34d23426b96346199", + "sha256:6124594e72ba216b00131795ad5ea5de1e0cf8784e63a01e0c6a4e4c13fc7914", + "sha256:6129063002fc8337b734f5963ac3eb01ead51e9c88c6d27e73ddc9236cb15b2e", + "sha256:75b38c236be6ca03e3dd3789f3044180fc0836b7c9e4991fcc52a8570f47dc91", + "sha256:9c711d4e4d003fec7f98fe87bb1faf7d88e6d648356413d8b8d9d76bd1844089", + "sha256:b15a0e61bd54764e658bc6931015453fa34d954f87c3b6fd35624e13bcacf69d", + "sha256:c22cdc37121b730e5fb87bc8d3eee8c4b1fe219a04d198a535fbd22895c99e27", + "sha256:c5ba74babfb3a6976611312e0026c4668913cdf05e009921e1f54146ccdc02a4" ], "index": "pypi", - "version": "==0.19.2" + "version": "==0.19.3" }, "pillow": { "hashes": [ - "sha256:0804f77cb1e9b6dbd37601cee11283bba39a8d44b9ddb053400c58e0c0d7d9de", - "sha256:0ab7c5b5d04691bcbd570658667dd1e21ca311c62dcfd315ad2255b1cd37f64f", - "sha256:0b3e6cf3ea1f8cecd625f1420b931c83ce74f00c29a0ff1ce4385f99900ac7c4", - "sha256:365c06a45712cd723ec16fa4ceb32ce46ad201eb7bbf6d3c16b063c72b61a3ed", - "sha256:38301fbc0af865baa4752ddae1bb3cbb24b3d8f221bf2850aad96b243306fa03", - "sha256:3aef1af1a91798536bbab35d70d35750bd2884f0832c88aeb2499aa2d1ed4992", - "sha256:3fe0ab49537d9330c9bba7f16a5f8b02da615b5c809cdf7124f356a0f182eccd", - "sha256:45a619d5c1915957449264c81c008934452e3fd3604e36809212300b2a4dab68", - "sha256:49f90f147883a0c3778fd29d3eb169d56416f25758d0f66775db9184debc8010", - "sha256:571b5a758baf1cb6a04233fb23d6cf1ca60b31f9f641b1700bfaab1194020555", - "sha256:5ac381e8b1259925287ccc5a87d9cf6322a2dc88ae28a97fe3e196385288413f", - "sha256:6153db744a743c0c8c91b8e3b9d40e0b13a5d31dbf8a12748c6d9bfd3ddc01ad", - "sha256:6fd63afd14a16f5d6b408f623cc2142917a1f92855f0df997e09a49f0341be8a", - "sha256:70acbcaba2a638923c2d337e0edea210505708d7859b87c2bd81e8f9902ae826", - "sha256:70b1594d56ed32d56ed21a7fbb2a5c6fd7446cdb7b21e749c9791eac3a64d9e4", - "sha256:76638865c83b1bb33bcac2a61ce4d13c17dba2204969dedb9ab60ef62bede686", - "sha256:7b2ec162c87fc496aa568258ac88631a2ce0acfe681a9af40842fc55deaedc99", - "sha256:7cee2cef07c8d76894ebefc54e4bb707dfc7f258ad155bd61d87f6cd487a70ff", - "sha256:7d16d4498f8b374fc625c4037742fbdd7f9ac383fd50b06f4df00c81ef60e829", - "sha256:b50bc1780681b127e28f0075dfb81d6135c3a293e0c1d0211133c75e2179b6c0", - "sha256:bd0582f831ad5bcad6ca001deba4568573a4675437db17c4031939156ff339fa", - "sha256:cfd40d8a4b59f7567620410f966bb1f32dc555b2b19f82a91b147fac296f645c", - "sha256:e3ae410089de680e8f84c68b755b42bc42c0ceb8c03dbea88a5099747091d38e", - "sha256:e9046e559c299b395b39ac7dbf16005308821c2f24a63cae2ab173bd6aa11616", - "sha256:ef6be704ae2bc8ad0ebc5cb850ee9139493b0fc4e81abcc240fb392a63ebc808", - "sha256:f8dc19d92896558f9c4317ee365729ead9d7bbcf2052a9a19a3ef17abbb8ac5b" + "sha256:00fdeb23820f30e43bba78eb9abb00b7a937a655de7760b2e09101d63708b64e", + "sha256:01f948e8220c85eae1aa1a7f8edddcec193918f933fb07aaebe0bfbbcffefbf1", + "sha256:08abf39948d4b5017a137be58f1a52b7101700431f0777bec3d897c3949f74e6", + "sha256:099a61618b145ecb50c6f279666bbc398e189b8bc97544ae32b8fcb49ad6b830", + "sha256:2c1c61546e73de62747e65807d2cc4980c395d4c5600ecb1f47a650c6fa78c79", + "sha256:2ed9c4f694861642401f27dc3cb99772be67cd190e84845c749dae0a06c3bfae", + "sha256:338581b30b908e111be578f0297255f6b57a51358cd16fa0e6f664c9a1f88bff", + "sha256:38c7d48a21cd06fdeee93987147b9b1c55b73b4cfcbf83240568bfbd5adee447", + "sha256:43fd026f613c8e48a25eba1a92f4d2ad7f3903c95d8c33a11611a7717d2ab654", + "sha256:4548236844327a718ce3bb182ab32a16fa2050c61e334e959f554cac052fb0df", + "sha256:5090857876c58885cfa388dc649e5db30aae98a068c26f3fd0ac9d7d9a4d9572", + "sha256:5bbba34f97a26a93f5e8dec469ca4ddd712451418add43da946dbaed7f7a98d2", + "sha256:65a28969a025a0eb4594637b6103201dc4ed2a9508bdab56ac33e43e3081c404", + "sha256:892bb52b70bd5ea9dbbc3ac44f38e84f5a04e9d8b1bff48159d96cb795b81159", + "sha256:8a9becd5cbd5062f973bcd2e7bc79483af310222de112b6541f8af1f93a3cc42", + "sha256:972a7aaeb7c4a2795b52eef52ee991ef040b31009f36deca6207a986607b55f3", + "sha256:97b119c436bfa96a92ac2ca525f7025836d4d4e64b1c9f9eff8dbaf3ff1d86f3", + "sha256:9ba37698e242223f8053cc158f130aee046a96feacbeab65893dbe94f5530118", + "sha256:b1b0e1f626a0f079c0d3696db70132fb1f29aa87c66aecb6501a9b8be64ce9f7", + "sha256:c14c1224fd1a5be2733530d648a316974dbbb3c946913562c6005a76f21ca042", + "sha256:c79a8546c48ae6465189e54e3245a97ddf21161e33ff7eaa42787353417bb2b6", + "sha256:ceb76935ac4ebdf6d7bc845482a4450b284c6ccfb281e34da51d510658ab34d8", + "sha256:e22bffaad04b4d16e1c091baed7f2733fc1ebb91e0c602abf1b6834d17158b1f", + "sha256:ec883b8e44d877bda6f94a36313a1c6063f8b1997aa091628ae2f34c7f97c8d5", + "sha256:f1baa54d50ec031d1a9beb89974108f8f2c0706f49798f4777df879df0e1adb6", + "sha256:f53a5385932cda1e2c862d89460992911a89768c65d176ff8c50cddca4d29bed" ], "index": "pypi", - "version": "==6.1.0" + "version": "==6.2.0" }, "psutil": { "hashes": [ @@ -365,10 +363,10 @@ }, "pytz": { "hashes": [ - "sha256:26c0b32e437e54a18161324a2fca3c4b9846b74a8dccddd843113109e1116b32", - "sha256:c894d57500a4cd2d5c71114aaab77dbab5eabd9022308ce5ac9bb93a60a6f0c7" + "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d", + "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be" ], - "version": "==2019.2" + "version": "==2019.3" }, "pyyaml": { "hashes": [ @@ -396,10 +394,10 @@ }, "redis": { "hashes": [ - "sha256:98a22fb750c9b9bb46e75e945dc3f61d0ab30d06117cbb21ff9cd1d315fedd3b", - "sha256:c504251769031b0dd7dd5cf786050a6050197c6de0d37778c80c08cb04ae8275" + "sha256:3613daad9ce5951e426f460deddd5caf469e08a3af633e9578fc77d362becf62", + "sha256:8d0fc278d3f5e1249967cba2eb4a5632d19e45ce5c09442b8422d15ee2c22cc2" ], - "version": "==3.3.8" + "version": "==3.3.11" }, "requests": { "hashes": [ @@ -442,9 +440,9 @@ }, "sqlalchemy": { "hashes": [ - "sha256:2f8ff566a4d3a92246d367f2e9cd6ed3edeef670dcd6dda6dfdc9efed88bcd80" + "sha256:0f0768b5db594517e1f5e1572c73d14cf295140756431270d89496dc13d5e46c" ], - "version": "==1.3.8" + "version": "==1.3.10" }, "sqlalchemy-utils": { "hashes": [ @@ -474,18 +472,18 @@ }, "urllib3": { "hashes": [ - "sha256:b246607a25ac80bedac05c6f282e3cdaf3afb65420fd024ac94435cabe6e18d1", - "sha256:dbe59173209418ae49d485b87d1681aefa36252ee85884c31346debd19463232" + "sha256:3de946ffbed6e6746608990594d08faac602528ac7015ac28d33cee6a45b7398", + "sha256:9a107b99a5393caf59c7aa3c1249c16e6879447533d0887f4336dde834c7be86" ], - "version": "==1.25.3" + "version": "==1.25.6" }, "wagtail": { "hashes": [ - "sha256:8b66ecf74d40ccc7070944ff2e5a3ae33e42ecf92eb98b92c155410e48f4c974", - "sha256:f0793d4de7d9064df04f6086e93992a5c1b07fb97f76996ea1a550bce3d57a16" + "sha256:c1f0c32f1b52ab61e4015ea1585c241ec6c043a15cc561f687815f2d3e204936", + "sha256:fe0a676c74d6caa6708668326b3380ee3746f74e7daec703a74a7ca23d2b9efd" ], "index": "pypi", - "version": "==2.6.1" + "version": "==2.6.2" }, "webencodings": { "hashes": [ @@ -496,11 +494,11 @@ }, "whitenoise": { "hashes": [ - "sha256:59d880d25d0e90bcc6554fe0504a11195bd2e59b3d690b6fb42a8040d4e67ef5", - "sha256:c9b7c47fdc1dba4d37bf2787a01a844dc7a521e174fcd22a2d429e0be65e1782" + "sha256:22f79cf8f1f509639330f93886acaece8ec5ac5e9600c3b981d33c34e8a42dfd", + "sha256:6dfea214b7c12efd689007abf9afa87a426586e9dbc051873ad2c8e535e2a1ac" ], "index": "pypi", - "version": "==4.1.3" + "version": "==4.1.4" }, "willow": { "hashes": [ @@ -520,18 +518,18 @@ }, "attrs": { "hashes": [ - "sha256:69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79", - "sha256:f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399" + "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c", + "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72" ], - "version": "==19.1.0" + "version": "==19.3.0" }, "django": { "hashes": [ - "sha256:33e4bb3f3268ecc362a7bd982c7f19fff30597c749fedbc1fd3773ebb82ec38c", - "sha256:f4351f1f921bb6c3de03e24cdba823365fb9a79a44f607ba2560e9e3b7f16ff3" + "sha256:79c6cfbc76a4612efc8a80d0094b96f50cb2aa654b2b2b530a4e707fa2985b4b", + "sha256:7a28a4eb0167eba491ccfafd7006843b5cdd26d8c93b955a74c2ea74f94efc2c" ], "index": "pypi", - "version": "==2.1.12" + "version": "==2.1.13" }, "django-debug-toolbar": { "hashes": [ @@ -550,11 +548,11 @@ }, "importlib-metadata": { "hashes": [ - "sha256:9ff1b1c5a354142de080b8a4e9803e5d0d59283c93aed808617c787d16768375", - "sha256:b7143592e374e50584564794fcb8aaf00a23025f9db866627f89a21491847a8d" + "sha256:aa18d7378b00b40847790e7c27e11673d7fed219354109d0e7b9e5b25dc3ad26", + "sha256:d5f18a79777f3aa179c145737780282e27b508fc8fd688cb17c7a813e8bd39af" ], "markers": "python_version < '3.8'", - "version": "==0.20" + "version": "==0.23" }, "more-itertools": { "hashes": [ @@ -565,17 +563,17 @@ }, "packaging": { "hashes": [ - "sha256:a7ac867b97fdc07ee80a8058fe4435ccd274ecc3b0ed61d852d7d53055528cf9", - "sha256:c491ca87294da7cc01902edbe30a5bc6c4c28172b5138ab4e4aa1b9d7bfaeafe" + "sha256:28b924174df7a2fa32c1953825ff29c61e2f5e082343165438812f00d3a7fc47", + "sha256:d9551545c6d761f3def1677baf08ab2a3ca17c56879e70fecba2fc4dde4ed108" ], - "version": "==19.1" + "version": "==19.2" }, "pluggy": { "hashes": [ - "sha256:0825a152ac059776623854c1543d65a4ad408eb3d33ee114dff91e57ec6ae6fc", - "sha256:b9817417e95936bf75d85d3f8767f7df6cdde751fc40aed3bb3074cbcb77757c" + "sha256:0db4b7601aae1d35b4a033282da476845aa19185c1e6964b25cf324b5e4ec3e6", + "sha256:fa5fa1622fa6dd5c030e9cad086fa19ef6a0cf6d7a2d12318e10cb49d6d68f34" ], - "version": "==0.12.0" + "version": "==0.13.0" }, "py": { "hashes": [ @@ -593,11 +591,11 @@ }, "pytest": { "hashes": [ - "sha256:95d13143cc14174ca1a01ec68e84d76ba5d9d493ac02716fd9706c949a505210", - "sha256:b78fe2881323bd44fd9bd76e5317173d4316577e7b1cddebae9136a4495ec865" + "sha256:7e4800063ccfc306a53c461442526c5571e1462f61583506ce97e4da6a1d88c8", + "sha256:ca563435f4941d0cb34767301c27bc65c510cb82e90b9ecf9cb52dc2c63caaa0" ], "index": "pypi", - "version": "==5.1.2" + "version": "==5.2.1" }, "pytest-splinter": { "hashes": [ @@ -608,10 +606,10 @@ }, "pytz": { "hashes": [ - "sha256:26c0b32e437e54a18161324a2fca3c4b9846b74a8dccddd843113109e1116b32", - "sha256:c894d57500a4cd2d5c71114aaab77dbab5eabd9022308ce5ac9bb93a60a6f0c7" + "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d", + "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be" ], - "version": "==2019.2" + "version": "==2019.3" }, "selenium": { "hashes": [ @@ -658,17 +656,17 @@ }, "urllib3": { "hashes": [ - "sha256:b246607a25ac80bedac05c6f282e3cdaf3afb65420fd024ac94435cabe6e18d1", - "sha256:dbe59173209418ae49d485b87d1681aefa36252ee85884c31346debd19463232" + "sha256:3de946ffbed6e6746608990594d08faac602528ac7015ac28d33cee6a45b7398", + "sha256:9a107b99a5393caf59c7aa3c1249c16e6879447533d0887f4336dde834c7be86" ], - "version": "==1.25.3" + "version": "==1.25.6" }, "virtualenv": { "hashes": [ - "sha256:680af46846662bb38c5504b78bad9ed9e4f3ba2d54f54ba42494fdf94337fe30", - "sha256:f78d81b62d3147396ac33fc9d77579ddc42cc2a98dd9ea38886f616b33bc7fb2" + "sha256:3e3597e89c73df9313f5566e8fc582bd7037938d15b05329c232ec57a11a7ad5", + "sha256:5d370508bf32e522d79096e8cbea3499d47e624ac7e11e9089f9397a0b3318df" ], - "version": "==16.7.5" + "version": "==16.7.6" }, "wcwidth": { "hashes": [ diff --git a/requirements.txt b/requirements.txt index d7a46e1..0b1edc5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -# Updated: 9.9.2019 +# Updated: 17.10.2019 # Core -wagtail==2.6.1 -Django==2.1.12 +wagtail==2.6.2 +Django==2.1.13 elasticsearch>=5.0.0,<6.0.0 # Database @@ -22,14 +22,14 @@ django-el-pagination==3.2.4 django-libsass==0.7 django-social-share==1.3.2 libsass==0.19.2 -Pillow==6.1.0 +Pillow==6.2.0 # Development tools stellar==0.4.5 # Production dependencies gunicorn==19.9.0 -whitenoise==4.1.3 +whitenoise==4.1.4 ConcurrentLogHandler==0.9.1 django-anymail==7.0.0 django-crispy-forms==1.7.2 From d1c2b145b98c93e705bac90ecc419d85fbcd413e Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Mon, 21 Oct 2019 20:24:16 +0200 Subject: [PATCH 10/16] Added style field to contact --- .../home/migrations/0028_contact_style.py | 18 ++++++++++++++++ publichealth/home/models/snippets.py | 2 ++ .../home/templates/tags/contact_info.html | 1 + publichealth/static/css/subsites.scss | 21 ++----------------- 4 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 publichealth/home/migrations/0028_contact_style.py diff --git a/publichealth/home/migrations/0028_contact_style.py b/publichealth/home/migrations/0028_contact_style.py new file mode 100644 index 0000000..58512c3 --- /dev/null +++ b/publichealth/home/migrations/0028_contact_style.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.13 on 2019-10-21 18:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0027_auto_20191017_1715'), + ] + + operations = [ + migrations.AddField( + model_name='contact', + name='style', + field=models.TextField(blank=True, default=''), + ), + ] diff --git a/publichealth/home/models/snippets.py b/publichealth/home/models/snippets.py index 16ce540..a18f9ca 100644 --- a/publichealth/home/models/snippets.py +++ b/publichealth/home/models/snippets.py @@ -70,6 +70,7 @@ class Contact(models.Model): email = models.EmailField(max_length=100, blank=True, default="") www = models.URLField(null=True, blank=True) + style = models.TextField(default="", blank=True) color = models.CharField(max_length=40, blank=True, default="") logo = models.ForeignKey( 'wagtailimages.Image', @@ -107,6 +108,7 @@ class Contact(models.Model): FieldPanel('www'), ImageChooserPanel('logo'), FieldPanel('color'), + FieldPanel('style'), FieldPanel('map_url'), FieldPanel('analytics'), PageChooserPanel('contact_form', 'home.ContactForm'), diff --git a/publichealth/home/templates/tags/contact_info.html b/publichealth/home/templates/tags/contact_info.html index bf63e6f..3120ba1 100644 --- a/publichealth/home/templates/tags/contact_info.html +++ b/publichealth/home/templates/tags/contact_info.html @@ -22,6 +22,7 @@