Merge branch 'release/ungleich-fixes'

This commit is contained in:
rascencio 2015-11-05 01:40:27 -06:00
commit b5f827ad01
12 changed files with 102 additions and 85 deletions

4
.gitignore vendored
View file

@ -28,3 +28,7 @@ ungleich.db
*~* *~*
secret-key secret-key
.idea/
.env

View file

@ -70,7 +70,7 @@ def blog(request):
def blog_detail(request, slug): def blog_detail(request, slug):
language = get_language() language = get_language()
post = Post.objects.translated(language, slug=slug).language(language).get() post = Post.objects.translated('en-us', slug=slug).get()
context = { context = {
'post': post, 'post': post,
} }

View file

@ -1,13 +0,0 @@
# from dynamicweb.settings import SITE_ROOT
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'db_name',
'USER': 'username',
'PASSWORD': 'password',
}
}

View file

@ -5,25 +5,28 @@ Copyright 2015 ungleich.
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os import os
import logging
import django.db.backends.postgresql_psycopg2
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
# dotenv
import dotenv
gettext = lambda s: s gettext = lambda s: s
def env(env_name):
return os.environ.get(env_name)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../.."),
)
# load .env file
dotenv.read_dotenv("{0}/.env".format(PROJECT_DIR))
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
ADMINS = (
('Nico Schottelius', 'nico.schottelius@ungleich.ch'),
)
# ('Sanghee Kim', 'sanghee.kim@ungleich.ch'),
MANAGERS = ADMINS
SITE_ID = 1 SITE_ID = 1
APP_ROOT_ENDPOINT = "/" APP_ROOT_ENDPOINT = "/"
@ -32,21 +35,10 @@ LOGIN_URL = None
LOGOUT_URL = None LOGOUT_URL = None
LOGIN_REDIRECT_URL = None LOGIN_REDIRECT_URL = None
EMAIL_HOST="localhost" EMAIL_HOST = "localhost"
EMAIL_PORT=25 EMAIL_PORT = 25
SECRET_KEY_FILE = os.path.join(BASE_DIR, "secret-key")
with open(SECRET_KEY_FILE, "r") as f:
SECRET_KEY = f.read().strip()
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = [
".ungleich.ch",
"digital.glarus.ungleich.ch" ,
]
SECRET_KEY = env('DJANGO_SECRET_KEY')
# Application definition # Application definition
@ -63,7 +55,7 @@ INSTALLED_APPS = (
'treebeard', # utilities for implementing a tree 'treebeard', # utilities for implementing a tree
'menus', # helper for model independent hierarchical website navigation 'menus', # helper for model independent hierarchical website navigation
'sekizai', # for javascript and css management 'sekizai', # for javascript and css management
#django-cms plugins # django-cms plugins
'djangocms_flash', 'djangocms_flash',
'djangocms_googlemap', 'djangocms_googlemap',
'djangocms_inherit', 'djangocms_inherit',
@ -71,7 +63,7 @@ INSTALLED_APPS = (
'djangocms_snippet', 'djangocms_snippet',
'djangocms_teaser', 'djangocms_teaser',
'djangocms_page_meta', 'djangocms_page_meta',
#django-filer # django-filer
'cmsplugin_filer_file', 'cmsplugin_filer_file',
'cmsplugin_filer_folder', 'cmsplugin_filer_folder',
'cmsplugin_filer_link', 'cmsplugin_filer_link',
@ -79,7 +71,7 @@ INSTALLED_APPS = (
'cmsplugin_filer_video', 'cmsplugin_filer_video',
# versioning # versioning
'reversion', 'reversion',
#ck-editor # ck-editor
'djangocms_text_ckeditor', 'djangocms_text_ckeditor',
# djangocms-blog # djangocms-blog
'filer', 'filer',
@ -116,7 +108,6 @@ MIDDLEWARE_CLASSES = (
'cms.middleware.toolbar.ToolbarMiddleware', 'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware', 'cms.middleware.language.LanguageCookieMiddleware',
) )
# 'django.middleware.security.SecurityMiddleware',
ROOT_URLCONF = 'dynamicweb.urls' ROOT_URLCONF = 'dynamicweb.urls'
@ -155,15 +146,13 @@ TEMPLATE_CONTEXT_PROCESSORS = (
) )
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'), os.path.join(PROJECT_DIR, 'templates'),
) )
CMS_TEMPLATES_DIR = { CMS_TEMPLATES_DIR = {
1: os.path.join(TEMPLATE_DIRS[0], 'cms/'), 1: os.path.join(TEMPLATE_DIRS[0], 'cms/'),
} }
# Database # Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
@ -240,20 +229,20 @@ CMS_PLACEHOLDER_CONF = {
], ],
}, },
'content': { 'content': {
'name' : _('Content'), 'name': _('Content'),
'default_plugins':[ 'default_plugins': [
{ {
'plugin_type':'TextPlugin', 'plugin_type': 'TextPlugin',
'values':{'body':'<p></p>'}, 'values': {'body': '<p></p>'},
}, },
] ]
}, },
'post_content': { 'post_content': {
'name' : _('Content'), 'name': _('Content'),
'default_plugins':[ 'default_plugins': [
{ {
'plugin_type':'TextPlugin', 'plugin_type': 'TextPlugin',
'values':{'body':'<p></p>'}, 'values': {'body': '<p></p>'},
}, },
] ]
}, },
@ -266,13 +255,6 @@ CACHES = {
} }
} }
try:
from dynamicweb.local.local_settings import *
except ImportError:
logging.warning("No local_settings file found.")
if not APP_ROOT_ENDPOINT.endswith('/'):
APP_ROOT += '/'
if LOGIN_URL is None: if LOGIN_URL is None:
LOGIN_URL = APP_ROOT_ENDPOINT + 'accounts/login/' LOGIN_URL = APP_ROOT_ENDPOINT + 'accounts/login/'
if LOGOUT_URL is None: if LOGOUT_URL is None:
@ -285,16 +267,15 @@ if LOGIN_REDIRECT_URL is None:
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
# Media files. MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = APP_ROOT_ENDPOINT + 'media/' MEDIA_URL = APP_ROOT_ENDPOINT + 'media/'
FILE_UPLOAD_PERMISSIONS = 0o644 FILE_UPLOAD_PERMISSIONS = 0o644
# Templates confs # Templates confs
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
os.path.join(BASE_DIR, "templates"), os.path.join(PROJECT_DIR, "templates"),
) )
META_SITE_PROTOCOL = 'http' META_SITE_PROTOCOL = 'http'
@ -343,7 +324,9 @@ THUMBNAIL_PROCESSORS = (
) )
# django-cms-text-ckeditor # django-cms-text-ckeditor
TEXT_SAVE_IMAGE_FUNCTION='cmsplugin_filer_image.integrations.ckeditor.create_image_plugin' TEXT_SAVE_IMAGE_FUNCTION = (
'cmsplugin_filer_image.integrations.ckeditor.create_image_plugin'
)
TEXT_ADDITIONAL_TAGS = ('iframe',) TEXT_ADDITIONAL_TAGS = ('iframe',)
TEXT_ADDITIONAL_ATTRIBUTES = ('scrolling', 'allowfullscreen', 'frameborder') TEXT_ADDITIONAL_ATTRIBUTES = ('scrolling', 'allowfullscreen', 'frameborder')
USE_X_FORWARDED_HOST = True USE_X_FORWARDED_HOST = True
@ -358,19 +341,23 @@ BOOTSTRAP3 = {
# The Bootstrap base URL # The Bootstrap base URL
'base_url': '//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/', 'base_url': '//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/',
# The complete URL to the Bootstrap CSS file (None means derive it from base_url) # The complete URL to the Bootstrap CSS file
# (None means derive it from base_url)
'css_url': None, 'css_url': None,
# The complete URL to the Bootstrap CSS file (None means no theme) # The complete URL to the Bootstrap CSS file (None means no theme)
'theme_url': None, 'theme_url': None,
# The complete URL to the Bootstrap JavaScript file (None means derive it from base_url) # The complete URL to the Bootstrap JavaScript file
# (None means derive it from base_url)
'javascript_url': None, 'javascript_url': None,
# Put JavaScript in the HEAD section of the HTML document (only relevant if you use bootstrap3.html) # Put JavaScript in the HEAD section of the HTML document
# (only relevant if you use bootstrap3.html)
'javascript_in_head': False, 'javascript_in_head': False,
# Include jQuery with Bootstrap JavaScript (affects django-bootstrap3 template tags) # Include jQuery with Bootstrap JavaScript
# (affects django-bootstrap3 template tags)
'include_jquery': False, 'include_jquery': False,
# Label class to use in horizontal forms # Label class to use in horizontal forms
@ -394,11 +381,13 @@ BOOTSTRAP3 = {
# Class to indicate error (better to set this in your Django form) # Class to indicate error (better to set this in your Django form)
'error_css_class': 'has-error', 'error_css_class': 'has-error',
# Class to indicate success, meaning the field has valid input (better to set this in your Django form) # Class to indicate success, meaning the field has valid input
# (better to set this in your Django form)
'success_css_class': 'has-success', 'success_css_class': 'has-success',
# Renderers (only set these if you have studied the source and understand the inner workings) # Renderers (only set these if you have studied the source and understand
'formset_renderers':{ # the inner workings)
'formset_renderers': {
'default': 'bootstrap3.renderers.FormsetRenderer', 'default': 'bootstrap3.renderers.FormsetRenderer',
}, },
'form_renderers': { 'form_renderers': {
@ -414,23 +403,21 @@ BOOTSTRAP3 = {
BLOG_ENABLE_COMMENTS = False BLOG_ENABLE_COMMENTS = False
BLOG_USE_PLACEHOLDER = True BLOG_USE_PLACEHOLDER = True
BLOG_IMAGE_THUMBNAIL_SIZE = {'size': '120x120', 'crop': True,'upscale': False} BLOG_IMAGE_THUMBNAIL_SIZE = {'size': '120x120', 'crop': True, 'upscale': False}
BLOG_IMAGE_FULL_SIZE = {'size': '640x120', 'crop': True,'upscale': False} BLOG_IMAGE_FULL_SIZE = {'size': '640x120', 'crop': True, 'upscale': False}
BLOG_PAGINATION = 4 BLOG_PAGINATION = 4
BLOG_LATEST_POSTS = BLOG_PAGINATION BLOG_LATEST_POSTS = BLOG_PAGINATION
BLOG_POSTS_LIST_TRUNCWORDS_COUNT = 100 BLOG_POSTS_LIST_TRUNCWORDS_COUNT = 100
BLOG_MULTISITE = True BLOG_MULTISITE = True
BLOG_AUTHOR_DEFAULT = True BLOG_AUTHOR_DEFAULT = True
#django-meta # django-meta
META_SITE_PROTOCOL = "https" META_SITE_PROTOCOL = "https"
META_SITE_DOMAIN = "ungleich.ch" META_SITE_DOMAIN = "ungleich.ch"
META_SITE_TYPE = "website" META_SITE_TYPE = "website"
META_SITE_NAME = "ungleich" META_SITE_NAME = "ungleich"
META_INCLUDE_KEYWORDS = ["ungleich", "hosting", "switzerland", "Schweiz", "Swiss", "cdist"] META_INCLUDE_KEYWORDS = ["ungleich", "hosting", "switzerland",
"Schweiz", "Swiss", "cdist"]
META_USE_SITES = True META_USE_SITES = True
try: PARLER_LANGUAGES = {1: ({'code': 'en-us'}, {'code': 'de'}, )}
from .local.local_settings import *
except ImportError as e:
pass

View file

@ -0,0 +1,21 @@
from .base import *
ALLOWED_HOSTS = [
"*"
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'app.db',
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'unique-snowflake'
}
}
DEBUG = True

View file

@ -0,0 +1,15 @@
from .base import *
DEBUG = False
ADMINS = (
('Nico Schottelius', 'nico.schottelius@ungleich.ch'),
)
# ('Sanghee Kim', 'sanghee.kim@ungleich.ch'),
MANAGERS = ADMINS
ALLOWED_HOSTS = [
".ungleich.ch",
"digital.glarus.ungleich.ch" ,
]

View file

@ -4,7 +4,7 @@ from django.contrib import admin
from django.conf.urls.i18n import i18n_patterns from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static from django.conf.urls.static import static
from dynamicweb import settings from django.conf import settings
from hosting.views import railshosting from hosting.views import railshosting
urlpatterns = [ urlpatterns = [

View file

@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dynamicweb.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dynamicweb.settings.prod")
application = get_wsgi_application() application = get_wsgi_application()

View file

@ -3,7 +3,7 @@ import os
import sys import sys
if __name__ == "__main__": if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dynamicweb.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dynamicweb.settings.local")
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line

View file

@ -56,3 +56,6 @@ gevent>=1.1a2
djangocms-page-meta djangocms-page-meta
# memcache # memcache
pylibmc pylibmc
# .env
django-dotenv

View file

@ -37,7 +37,7 @@
</head> </head>
<body> <body>
{% cms_toolbar %} {% cms_toolbar %}
{% show_menu 0 1 100 100 "cms/ungleichch/_menu.html" %} {% show_menu 0 0 0 1 "cms/ungleichch/_menu.html" %}
<!-- body --> <!-- body -->
<!-- Main Content --> <!-- Main Content -->
{% block base_header %} {% block base_header %}