Merge branch 'develop' into 'master'

Python 3.7 and path fixes

See merge request sahkoinsinoorikilta/vtmk/web2.0-backend!7
This commit is contained in:
Aarni Halinen
2019-10-09 21:11:12 +00:00
9 changed files with 28 additions and 11 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ stages:
- deploy - deploy
test: test:
image: python:3.5 image: python:3.7
stage: test stage: test
services: services:
- postgres:latest - postgres:latest
@@ -24,7 +24,7 @@ test:
- python manage.py test - python manage.py test
pycodestyle: pycodestyle:
image: python:3.5 image: python:3.7
stage: lint stage: lint
script: script:
- pip install pycodestyle - pip install pycodestyle
+1 -1
View File
@@ -1 +1 @@
3.6.8 3.7.4
+1 -1
View File
@@ -1,4 +1,4 @@
FROM python:3.5 FROM python:3.7
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
ENV IS_DOCKER 1 ENV IS_DOCKER 1
RUN mkdir /code RUN mkdir /code
+5 -4
View File
@@ -11,6 +11,7 @@ from django.core.mail import send_mail
import logging import logging
import requests import requests
from dealer.git import git from dealer.git import git
from sikweb.settings import URL
from members.views.utils import * from members.views.utils import *
from kaehmy.models import Application, CustomRole, PresetRole, TelegramChannel from kaehmy.models import Application, CustomRole, PresetRole, TelegramChannel
@@ -60,12 +61,12 @@ def comment(request, *args, **kwargs):
name = comment.name name = comment.name
subject = 'Kaehmyysi tai kommenttiisi on vastattu!' subject = 'Kaehmyysi tai kommenttiisi on vastattu!'
body = ('{} on vastannut kaehmyhakemukseesi tai kommenttiisi kaehmypalvelussa.\r\n\r\n' body = (f'{name.capitalize()} on vastannut kaehmyhakemukseesi tai kommenttiisi kaehmypalvelussa.\r\n\r\n'
'Käy lukemassa viesti osoitteessa http://sika.sahkoinsinoorikilta.fi/kaehmy').format(name.capitalize()) 'Käy lukemassa viesti osoitteessa https://{URL}/kaehmy')
send_email(email, subject, body) send_email(email, subject, body)
logging.debug( logging.debug(
'Sent kaehmy comment email to recipient <{}>'.format(email)) f'Sent kaehmy comment email to recipient <{email}>')
return redirect('/kaehmy') return redirect('/kaehmy')
else: else:
@@ -123,7 +124,7 @@ def submit(request, *args, **kwargs):
custom_role.save() custom_role.save()
application.custom_roles.add(custom_role) application.custom_roles.add(custom_role)
url = 'https://sika.sahkoinsinoorikilta.fi/kaehmy' url = f'https://{URL}/kaehmy'
email = form.cleaned_data.get('email', '') email = form.cleaned_data.get('email', '')
name = form.cleaned_data.get('name', 'Anonymous') name = form.cleaned_data.get('name', 'Anonymous')
+2 -1
View File
@@ -14,6 +14,7 @@ from django.template.loader import render_to_string
import logging import logging
import requests import requests
from dealer.git import git from dealer.git import git
from sikweb.settings import URL
from ohlhafv.models import OhlhafvChallenge from ohlhafv.models import OhlhafvChallenge
from ohlhafv.forms import OhlhafvForm from ohlhafv.forms import OhlhafvForm
@@ -39,7 +40,7 @@ def ohlhafv_submit(request, *args, **kwargs):
challenge = form.instance challenge = form.instance
email = form.cleaned_data.get('victim_email', '') email = form.cleaned_data.get('victim_email', '')
url = 'https://sika.sahkoinsinoorikilta.fi/ohlhafv/list' url = f'https://{URL}/ohlhafv/list'
subject = _('Sinut on haastettu Øhlhäfviin!') subject = _('Sinut on haastettu Øhlhäfviin!')
message = render_to_string( message = render_to_string(
+2 -2
View File
@@ -9,7 +9,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git@sika.sahkoinsinoorikilta.fi:vtmk/web2.0.git" "url": "git@gitlab.com:sahkoinsinoorikilta/vtmk/web2.0-backend.git"
}, },
"author": "SIK ry", "author": "SIK ry",
"license": "ISC", "license": "ISC",
@@ -23,4 +23,4 @@
"remark-preset-lint-recommended" "remark-preset-lint-recommended"
] ]
} }
} }
+1
View File
@@ -17,6 +17,7 @@ from sikweb.base import *
DEBUG = False DEBUG = False
ALLOWED_HOSTS = ["sika.sik.party"] ALLOWED_HOSTS = ["sika.sik.party"]
URL = "sika.sik.party"
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv('SECRET_KEY', '<your secret key>') SECRET_KEY = os.getenv('SECRET_KEY', '<your secret key>')
+1
View File
@@ -17,6 +17,7 @@ from sikweb.base import *
DEBUG = True DEBUG = True
# ALLOWED_HOSTS = ["*"] # ALLOWED_HOSTS = ["*"]
URL = "sika.sik.party"
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '7p$85^4ibb^p4-=vs44b7!y0e-zemugze18@a#30&71=a8)dp(' SECRET_KEY = '7p$85^4ibb^p4-=vs44b7!y0e-zemugze18@a#30&71=a8)dp('
+13
View File
@@ -2,6 +2,13 @@ version: '3.4'
services: services:
db: db:
image: postgres:10 image: postgres:10
deploy:
replicas: 1
restart_policy:
condition: on-failure
update_config:
order: start-first
environment: environment:
- POSTGRES_USER_FILE=/run/secrets/DJANGO_DB_USER - POSTGRES_USER_FILE=/run/secrets/DJANGO_DB_USER
- POSTGRES_PASSWORD_FILE=/run/secrets/DJANGO_DB_PASSWD - POSTGRES_PASSWORD_FILE=/run/secrets/DJANGO_DB_PASSWD
@@ -15,6 +22,12 @@ services:
backend: backend:
image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-backend:latest image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-backend:latest
deploy:
replicas: 1
restart_policy:
condition: on-failure
update_config:
order: start-first
depends_on: depends_on:
- db - db
ports: ports: