Merge branch 'develop'. Disqus commenting.

master
androiddrew 6 years ago
commit 08268c806e

@ -3,7 +3,7 @@ version: '3.6'
services:
cms:
image: androiddrew/datasketch:0.1.4
image: androiddrew/datasketch:0.2.1
command: gunicorn cms.wsgi:application --bind 0.0.0.0:5000 --workers 3
deploy:
replicas: 1

@ -6,7 +6,7 @@
{% block content %}
{% include 'header.html' %}
<article class="ph3 ph3-ns center mw8">
<article class="ph3 ph3-ns center mw8 lh-copy">
<h1>{{ page.title }}</h1>
<p class="meta">{{ page.date }}</p>
{% if page.tags.all.count %}
@ -19,12 +19,24 @@
{{ page.body|richtext }}
{% for item in page.gallery_images.all %}
<div class="fl ma1">
{% image item.image fill-320x240 %}
<p> {{ item.caption }}</p>
</div>
{% endfor %}
</article>
<div id="disqus_thread" class="mw8 center"></div>
<script>
{% if commenting %}
var disqus_config = function () {
this.page.url = {{ page.full_url }};
this.page.identifier = {{ page.slug }};
};
{% endif %}
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://datasketch-io.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
{% endblock %}

@ -0,0 +1,7 @@
from django.conf import settings
def commenting(context):
"""Template context processor used to check if a COMMENTING setting is True"""
return {"commenting": settings.COMMENTING}

@ -16,7 +16,6 @@ import os
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
@ -73,6 +72,7 @@ TEMPLATES = [
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"cms.context_processors.commenting"
]
},
}
@ -80,7 +80,6 @@ TEMPLATES = [
WSGI_APPLICATION = "cms.wsgi.application"
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
@ -104,7 +103,6 @@ AUTH_PASSWORD_VALIDATORS = [
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
]
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
@ -118,7 +116,6 @@ USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
@ -140,7 +137,6 @@ STATIC_URL = "/static/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = "/media/"
# Wagtail settings
WAGTAIL_SITE_NAME = "datasketch.io"
@ -148,3 +144,10 @@ WAGTAIL_SITE_NAME = "datasketch.io"
# Base URL to use when referring to full URLs within the Wagtail admin backend -
# e.g. in notification emails. Don't include '/admin' or a trailing slash
BASE_URL = "https://datasketch.io"
INTERNAL_IPS = [
'127.0.0.1',
]
# Disqus comment integration
COMMENTING = False

@ -22,6 +22,8 @@ DATABASES = {
}
}
COMMENTING = False
try:
from .local import *
except ImportError:

@ -40,6 +40,8 @@ LOGGING = {
},
}
COMMENTING = True
try:
from .local import *

Loading…
Cancel
Save