Commit db3f307b authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Merge branch 'templatecheck_only_when_installed' into 'master'

Only set up templatecheck if installed

See merge request !734
parents ad685ca1 fe69674c
...@@ -2,6 +2,9 @@ FROM python:3.5 ...@@ -2,6 +2,9 @@ FROM python:3.5
MAINTAINER Thom Wiggers <thom@thomwiggers.nl> MAINTAINER Thom Wiggers <thom@thomwiggers.nl>
LABEL description="Contains the Thaliawebsite Django application" LABEL description="Contains the Thaliawebsite Django application"
# Arguments
ARG install_dev_requirements=1
# Try to keep static operation on top to maximise Docker cache utilisation # Try to keep static operation on top to maximise Docker cache utilisation
# Disable output buffering # Disable output buffering
...@@ -41,9 +44,13 @@ COPY docs/requirements.txt /usr/src/app/docs/ ...@@ -41,9 +44,13 @@ COPY docs/requirements.txt /usr/src/app/docs/
RUN pip install --no-cache-dir \ RUN pip install --no-cache-dir \
-r requirements.txt \ -r requirements.txt \
-r production-requirements.txt \ -r production-requirements.txt \
-r dev-requirements.txt \
-r ../docs/requirements.txt -r ../docs/requirements.txt
RUN if [ "$install_dev_requirements" -eq 1 ]; then \
pip install --no-cache-dir -r dev-requirements.txt; \
fi
# Create entry points # Create entry points
COPY resources/entrypoint.sh /usr/local/bin/entrypoint.sh COPY resources/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY resources/entrypoint_production.sh /usr/local/bin/entrypoint_production.sh COPY resources/entrypoint_production.sh /usr/local/bin/entrypoint_production.sh
...@@ -59,3 +66,5 @@ COPY docs /usr/src/app/docs ...@@ -59,3 +66,5 @@ COPY docs /usr/src/app/docs
# Cache docs between builds if not mounting to FS # Cache docs between builds if not mounting to FS
VOLUME /concrexit/docs VOLUME /concrexit/docs
RUN echo "Don't build releases without release.sh!"
...@@ -72,7 +72,7 @@ fi ...@@ -72,7 +72,7 @@ fi
docker_tag="registry.gitlab.com/thaliawww/concrexit:$version" docker_tag="registry.gitlab.com/thaliawww/concrexit:$version"
docker build --pull -t "$docker_tag" . docker build --build-arg install_dev_requirements=0 --pull -t "$docker_tag" .
if yesno "Do you want to push the container?"; then if yesno "Do you want to push the container?"; then
docker push "$docker_tag" docker push "$docker_tag"
......
...@@ -4,7 +4,6 @@ Pillow>=5.0,<5.1 ...@@ -4,7 +4,6 @@ Pillow>=5.0,<5.1
django-compressor>=2.1,<3 django-compressor>=2.1,<3
django-sendfile<=0.4 django-sendfile<=0.4
freezegun>=0.3.9,<0.4.0 freezegun>=0.3.9,<0.4.0
django-template-check>=0.3.0 # This should be in dev-requirements somehow
bleach>=2.1.0,<2.2 bleach>=2.1.0,<2.2
django-tinymce4-lite>=1.7,<1.8 django-tinymce4-lite>=1.7,<1.8
rcssmin>=1.0.6 rcssmin>=1.0.6
......
...@@ -10,7 +10,7 @@ commands = ...@@ -10,7 +10,7 @@ commands =
; specified below ; specified below
cp {toxinidir}/requirements.txt {envbindir}/reqtemp.txt cp {toxinidir}/requirements.txt {envbindir}/reqtemp.txt
sed -i /Django>=.*/d {envbindir}/reqtemp.txt sed -i /Django>=.*/d {envbindir}/reqtemp.txt
pip install -r{envbindir}/reqtemp.txt pip install -r{envbindir}/reqtemp.txt -r{toxinidir}/dev-requirements.txt
pipconflictchecker # if this fails, use pipdeptree to debug pipconflictchecker # if this fails, use pipdeptree to debug
python manage.py check python manage.py check
python manage.py templatecheck --project-only python manage.py templatecheck --project-only
......
...@@ -17,7 +17,6 @@ from django.utils.log import DEFAULT_LOGGING ...@@ -17,7 +17,6 @@ from django.utils.log import DEFAULT_LOGGING
from . import settings from . import settings
INSTALLED_APPS = settings.INSTALLED_APPS INSTALLED_APPS = settings.INSTALLED_APPS
INSTALLED_APPS.remove('django_template_check')
INSTALLED_APPS.append('django_slack') INSTALLED_APPS.append('django_slack')
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
......
...@@ -50,7 +50,6 @@ INSTALLED_APPS = [ ...@@ -50,7 +50,6 @@ INSTALLED_APPS = [
'django.contrib.sitemaps', 'django.contrib.sitemaps',
# Dependencies # Dependencies
'tinymce', 'tinymce',
'django_template_check', # This is only necessary in development
'rest_framework', 'rest_framework',
'rest_framework.authtoken', 'rest_framework.authtoken',
'compressor', 'compressor',
...@@ -78,6 +77,15 @@ INSTALLED_APPS = [ ...@@ -78,6 +77,15 @@ INSTALLED_APPS = [
'payments.apps.PaymentsConfig', 'payments.apps.PaymentsConfig',
] ]
# enable template check if it's installed
# this allows us to not have it enabled in production
try:
import django_template_check
del django_template_check
INSTALLED_APPS.append('django_template_check')
except ImportError:
pass
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment