2015-11-02 20:44:18 +00:00
"""
Copyright 2015 ungleich .
"""
# -*- coding: utf-8 -*-
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
2016-03-05 19:57:41 +00:00
2015-11-02 20:44:18 +00:00
from django . utils . translation import ugettext_lazy as _
2016-03-05 19:57:41 +00:00
2015-11-02 20:44:18 +00:00
# dotenv
import dotenv
gettext = lambda s : s
2015-11-05 07:02:18 +00:00
2015-11-02 20:44:18 +00:00
def env ( env_name ) :
return os . environ . get ( env_name )
2016-03-05 19:57:41 +00:00
2015-11-02 20:44:18 +00:00
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 ) )
SITE_ID = 1
APP_ROOT_ENDPOINT = " / "
2016-05-07 21:05:46 +00:00
APPEND_SLASH = True
2015-11-02 20:44:18 +00:00
LOGIN_URL = None
LOGOUT_URL = None
LOGIN_REDIRECT_URL = None
2015-11-05 07:02:18 +00:00
EMAIL_HOST = " localhost "
EMAIL_PORT = 25
2015-11-02 20:44:18 +00:00
SECRET_KEY = env ( ' DJANGO_SECRET_KEY ' )
# Application definition
INSTALLED_APPS = (
2016-05-07 21:05:46 +00:00
# 1st migrate
2016-03-07 16:49:02 +00:00
' membership ' ,
2015-11-02 20:44:18 +00:00
' django.contrib.admin ' ,
' django.contrib.auth ' ,
' django.contrib.contenttypes ' ,
' django.contrib.sessions ' ,
' django.contrib.messages ' ,
' django.contrib.staticfiles ' ,
' django.contrib.sites ' ,
' easy_thumbnails ' ,
2016-04-10 21:12:43 +00:00
' utils ' ,
2016-03-15 23:26:49 +00:00
' mptt ' ,
2015-11-02 20:44:18 +00:00
' parler ' ,
' taggit ' ,
' taggit_autosuggest ' ,
2016-03-25 18:18:07 +00:00
# 'django_select2',
2015-11-02 20:44:18 +00:00
' meta ' ,
' meta_mixin ' ,
' bootstrap3 ' ,
' compressor ' ,
2016-03-07 16:49:02 +00:00
' filer ' ,
2016-03-07 17:39:24 +00:00
' djangocms_blog ' ,
2016-03-15 23:26:49 +00:00
' cms ' , # django CMS itself
2016-03-25 18:18:07 +00:00
' aldryn_apphooks_config ' ,
' aldryn_boilerplates ' ,
' aldryn_categories ' ,
' aldryn_common ' ,
' aldryn_newsblog ' ,
' aldryn_people ' ,
' aldryn_reversion ' ,
' aldryn_translation_tools ' ,
2015-11-02 20:44:18 +00:00
' treebeard ' , # utilities for implementing a tree
' sekizai ' , # for javascript and css management
2016-03-15 23:26:49 +00:00
' menus ' , # helper for model independent hierarchical website navigation
' cmsplugin_filer_image ' ,
2016-03-19 20:28:58 +00:00
2016-05-07 21:05:46 +00:00
# 2nd migrate
2015-11-05 07:02:18 +00:00
# django-cms plugins
2016-05-07 21:05:46 +00:00
' djangocms_file ' ,
' djangocms_picture ' ,
' djangocms_video ' ,
2016-05-20 15:00:06 +00:00
# 'djangocms_flash',
# 'djangocms_googlemap',
# 'djangocms_inherit',
# 'djangocms_link',
# 'djangocms_teaser',
2016-05-07 21:05:46 +00:00
' djangocms_page_meta ' ,
' djangocms_text_ckeditor ' ,
' djangocms_admin_style ' ,
' cmsplugin_filer_file ' ,
' cmsplugin_filer_folder ' ,
' cmsplugin_filer_link ' ,
2016-05-20 15:00:06 +00:00
# 'cmsplugin_filer_teaser',
2016-05-07 21:05:46 +00:00
' cmsplugin_filer_video ' ,
2016-03-22 00:21:50 +00:00
#
2016-05-07 21:05:46 +00:00
# blog
2015-11-02 20:44:18 +00:00
# versioning
' reversion ' ,
# ungleich
' ungleich ' ,
2016-05-20 15:00:06 +00:00
' ungleich_page ' ,
2015-11-02 20:44:18 +00:00
' hosting ' ,
' digitalglarus ' ,
)
MIDDLEWARE_CLASSES = (
' django.contrib.sessions.middleware.SessionMiddleware ' ,
' django.middleware.common.CommonMiddleware ' ,
' django.middleware.csrf.CsrfViewMiddleware ' ,
' django.contrib.auth.middleware.AuthenticationMiddleware ' ,
' django.contrib.auth.middleware.SessionAuthenticationMiddleware ' ,
' django.contrib.messages.middleware.MessageMiddleware ' ,
' django.middleware.clickjacking.XFrameOptionsMiddleware ' ,
' django.middleware.locale.LocaleMiddleware ' ,
# django-cms middlewares
' cms.middleware.user.CurrentUserMiddleware ' ,
' cms.middleware.page.CurrentPageMiddleware ' ,
' cms.middleware.toolbar.ToolbarMiddleware ' ,
' cms.middleware.language.LanguageCookieMiddleware ' ,
)
ROOT_URLCONF = ' dynamicweb.urls '
TEMPLATES = [
{
' BACKEND ' : ' django.template.backends.django.DjangoTemplates ' ,
2016-05-07 21:05:46 +00:00
' DIRS ' : [ os . path . join ( PROJECT_DIR , ' cms_templates/ ' ) ,
os . path . join ( PROJECT_DIR , ' cms_templates/djangocms_blog/ ' ) ,
os . path . join ( PROJECT_DIR , ' membership ' ) ,
os . path . join ( PROJECT_DIR , ' ungleich/templates/djangocms_blog/ ' ) ,
os . path . join ( PROJECT_DIR , ' ungleich/templates/cms/ungleichch ' ) ,
os . path . join ( PROJECT_DIR , ' ungleich/templates/ungleich ' )
] ,
2015-11-02 20:44:18 +00:00
' APP_DIRS ' : True ,
' OPTIONS ' : {
' context_processors ' : [
' django.template.context_processors.debug ' ,
' django.template.context_processors.request ' ,
' django.contrib.auth.context_processors.auth ' ,
' django.contrib.messages.context_processors.messages ' ,
2016-03-05 19:57:41 +00:00
" django.core.context_processors.media " ,
" django.core.context_processors.static " ,
" django.core.context_processors.tz " ,
" django.contrib.messages.context_processors.messages " ,
' sekizai.context_processors.sekizai ' ,
' cms.context_processors.cms_settings ' ,
2015-11-02 20:44:18 +00:00
] ,
} ,
} ,
]
WSGI_APPLICATION = ' dynamicweb.wsgi.application '
2016-04-01 10:37:01 +00:00
CMS_TEMPLATES = (
( ' base_glarus.html ' , gettext ( ' default ' ) ) ,
( ' one_column.html ' , gettext ( ' 2 Column ' ) ) ,
( ' two_columns.html ' , gettext ( ' 3 Column ' ) ) ,
( ' about.html ' , gettext ( ' DG.About ' ) ) ,
( ' contact.html ' , gettext ( ' DG.Contact ' ) ) ,
2016-04-09 06:51:20 +00:00
( ' home_digitalglarus.html ' , gettext ( ' DG.Home ' ) ) ,
2016-04-01 10:37:01 +00:00
( ' letscowork.html ' , gettext ( ' DG.CoWork ' ) ) ,
2016-04-03 09:46:25 +00:00
# ('detail.html', gettext('DG.Detail')),
( ' one_column.html ' , gettext ( ' DG.OneColumn ' ) ) ,
2016-05-07 21:05:46 +00:00
# ungleich
2016-04-03 09:46:25 +00:00
( ' blog_ungleich.html ' , gettext ( ' Blog ' ) ) ,
( ' page.html ' , gettext ( ' Page ' ) ) ,
2016-04-01 10:37:01 +00:00
)
2015-11-02 20:44:18 +00:00
DATABASES = {
' default ' : {
' ENGINE ' : ' django.db.backends.postgresql_psycopg2 ' ,
2016-05-20 15:00:06 +00:00
' NAME ' : ' app ' ,
2015-11-02 20:44:18 +00:00
}
}
2016-04-07 05:26:50 +00:00
2015-11-02 20:44:18 +00:00
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
TIME_ZONE = ' UTC '
USE_I18N = True
USE_L10N = True
USE_TZ = True
LANGUAGES = (
( ' en-us ' , _ ( ' English ' ) ) ,
( ' de ' , _ ( ' Deutsch ' ) ) ,
)
LANGUAGE_CODE = ' en-us '
2016-04-09 07:53:05 +00:00
LOCALE_PATHS = [
2016-05-07 21:05:46 +00:00
os . path . join ( PROJECT_DIR , ' digitalglarus/locale ' ) ,
2016-04-09 07:53:05 +00:00
]
2015-11-02 20:44:18 +00:00
CMS_PLACEHOLDER_CONF = {
' logo_image ' : {
' name ' : ' Logo Image ' ,
' plugins ' : [ ' FilerImagePlugin ' ] ,
' limits ' : {
' global ' : 1 ,
}
} ,
' page-title ' : {
' name ' : ' Page Title ' ,
' plugins ' : [ ' TextPlugin ' ] ,
' default_plugins ' : [
{
' plugin_type ' : ' TextPlugin ' ,
' values ' : {
' body ' : ' Page Title... '
}
}
] ,
' limits ' : {
' global ' : 1 ,
}
} ,
' page-subtitle ' : {
' name ' : ' Page Subtitle ' ,
' inherit ' : ' page-title ' ,
' default_plugins ' : [
{
' plugin_type ' : ' TextPlugin ' ,
' values ' : {
' body ' : ' Page subtitle... '
}
}
] ,
} ,
' footer_copyright ' : {
' name ' : ' Copyright ' ,
' inherit ' : ' page-title ' ,
' default_plugins ' : [
{
' plugin_type ' : ' TextPlugin ' ,
' values ' : {
' body ' : ' Copyright... '
}
}
] ,
} ,
' content ' : {
2015-11-05 07:02:18 +00:00
' name ' : _ ( ' Content ' ) ,
' default_plugins ' : [
2015-11-02 20:44:18 +00:00
{
2015-11-05 07:02:18 +00:00
' plugin_type ' : ' TextPlugin ' ,
' values ' : { ' body ' : ' <p></p> ' } ,
2015-11-02 20:44:18 +00:00
} ,
]
} ,
' post_content ' : {
2015-11-05 07:02:18 +00:00
' name ' : _ ( ' Content ' ) ,
' default_plugins ' : [
2015-11-02 20:44:18 +00:00
{
2015-11-05 07:02:18 +00:00
' plugin_type ' : ' TextPlugin ' ,
' values ' : { ' body ' : ' <p></p> ' } ,
2015-11-02 20:44:18 +00:00
} ,
]
} ,
}
CACHES = {
' default ' : {
' BACKEND ' : ' django.core.cache.backends.memcached.PyLibMCCache ' ,
' LOCATION ' : ' 127.0.0.1:11211 ' ,
}
}
2016-05-20 15:00:06 +00:00
if LOGIN_URL is None :
LOGIN_URL = APP_ROOT_ENDPOINT + ' login/ '
if LOGOUT_URL is None :
LOGOUT_URL = APP_ROOT_ENDPOINT + ' logout/ '
if LOGIN_REDIRECT_URL is None :
LOGIN_REDIRECT_URL = APP_ROOT_ENDPOINT
2015-11-02 20:44:18 +00:00
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = ' /static/ '
2015-11-02 21:58:52 +00:00
STATIC_ROOT = os . path . join ( PROJECT_DIR , ' static ' )
2015-11-02 20:44:18 +00:00
2015-11-02 21:58:52 +00:00
MEDIA_ROOT = os . path . join ( PROJECT_DIR , ' media ' )
2015-11-02 20:44:18 +00:00
MEDIA_URL = APP_ROOT_ENDPOINT + ' media/ '
FILE_UPLOAD_PERMISSIONS = 0o644
META_SITE_PROTOCOL = ' http '
META_USE_SITES = True
MIGRATION_MODULES = {
' cms ' : ' cms.migrations ' ,
2016-05-20 15:00:06 +00:00
# 'filer': 'filer.migrations_django',
2016-03-07 17:39:24 +00:00
# 'menus': 'menus.migrations_django',
2015-11-02 20:44:18 +00:00
' djangocms_flash ' : ' djangocms_flash.migrations_django ' ,
' djangocms_googlemap ' : ' djangocms_googlemap.migrations_django ' ,
' djangocms_inherit ' : ' djangocms_inherit.migrations_django ' ,
' djangocms_link ' : ' djangocms_link.migrations_django ' ,
' djangocms_teaser ' : ' djangocms_teaser.migrations_django ' ,
' djangocms_column ' : ' djangocms_column.migrations_django ' ,
' djangocms_flash ' : ' djangocms_flash.migrations_django ' ,
' djangocms_googlemap ' : ' djangocms_googlemap.migrations_django ' ,
' djangocms_inherit ' : ' djangocms_inherit.migrations_django ' ,
' djangocms_style ' : ' djangocms_style.migrations_django ' ,
' cmsplugin_filer_image ' : ' cmsplugin_filer_image.migrations_django ' ,
' cmsplugin_filer_file ' : ' cmsplugin_filer_file.migrations_django ' ,
' cmsplugin_filer_folder ' : ' cmsplugin_filer_folder.migrations_django ' ,
' cmsplugin_filer_link ' : ' cmsplugin_filer_link.migrations_django ' ,
' cmsplugin_filer_teaser ' : ' cmsplugin_filer_teaser.migrations_django ' ,
' cmsplugin_filer_utils ' : ' cmsplugin_filer_utils.migrations_django ' ,
' cmsplugin_filer_video ' : ' cmsplugin_filer_video.migrations_django ' ,
' djangocms_text_ckeditor ' : ' djangocms_text_ckeditor.migrations ' ,
}
STATICFILES_FINDERS = (
' django.contrib.staticfiles.finders.FileSystemFinder ' ,
' django.contrib.staticfiles.finders.AppDirectoriesFinder ' ,
' compressor.finders.CompressorFinder ' ,
)
2016-05-07 21:05:46 +00:00
# COMPRESS_PRECOMPILERS = (
2016-03-19 20:28:58 +00:00
# ('text/less', 'lesscpy {infile}'),
2016-05-07 21:05:46 +00:00
# )
2015-11-02 20:44:18 +00:00
THUMBNAIL_PROCESSORS = (
' easy_thumbnails.processors.colorspace ' ,
' easy_thumbnails.processors.autocrop ' ,
' filer.thumbnail_processors.scale_and_crop_with_subject_location ' ,
' easy_thumbnails.processors.filters ' ,
)
# django-cms-text-ckeditor
2015-11-05 07:02:18 +00:00
TEXT_SAVE_IMAGE_FUNCTION = (
' cmsplugin_filer_image.integrations.ckeditor.create_image_plugin '
)
2015-11-02 20:44:18 +00:00
TEXT_ADDITIONAL_TAGS = ( ' iframe ' , )
TEXT_ADDITIONAL_ATTRIBUTES = ( ' scrolling ' , ' allowfullscreen ' , ' frameborder ' )
USE_X_FORWARDED_HOST = True
# Django Bootstrap - Settings
# Added Configuration for bootstrap static files to load over https.
BOOTSTRAP3 = {
# The URL to the jQuery JavaScript file
' jquery_url ' : ' //code.jquery.com/jquery.min.js ' ,
# The Bootstrap base URL
' base_url ' : ' //maxcdn.bootstrapcdn.com/bootstrap/3.3.4/ ' ,
2015-11-05 07:02:18 +00:00
# The complete URL to the Bootstrap CSS file
# (None means derive it from base_url)
2015-11-02 20:44:18 +00:00
' css_url ' : None ,
# The complete URL to the Bootstrap CSS file (None means no theme)
' theme_url ' : None ,
2015-11-05 07:02:18 +00:00
# The complete URL to the Bootstrap JavaScript file
# (None means derive it from base_url)
2015-11-02 20:44:18 +00:00
' javascript_url ' : None ,
2015-11-05 07:02:18 +00:00
# Put JavaScript in the HEAD section of the HTML document
# (only relevant if you use bootstrap3.html)
2015-11-02 20:44:18 +00:00
' javascript_in_head ' : False ,
2015-11-05 07:02:18 +00:00
# Include jQuery with Bootstrap JavaScript
# (affects django-bootstrap3 template tags)
2015-11-02 20:44:18 +00:00
' include_jquery ' : False ,
# Label class to use in horizontal forms
' horizontal_label_class ' : ' col-md-3 ' ,
# Field class to use in horizontal forms
' horizontal_field_class ' : ' col-md-9 ' ,
# Set HTML required attribute on required fields
' set_required ' : True ,
# Set HTML disabled attribute on disabled fields
' set_disabled ' : False ,
# Set placeholder attributes to label if no placeholder is provided
' set_placeholder ' : True ,
# Class to indicate required (better to set this in your Django form)
' required_css_class ' : ' ' ,
# Class to indicate error (better to set this in your Django form)
' error_css_class ' : ' has-error ' ,
2015-11-05 07:02:18 +00:00
# Class to indicate success, meaning the field has valid input
# (better to set this in your Django form)
2015-11-02 20:44:18 +00:00
' success_css_class ' : ' has-success ' ,
2015-11-05 07:02:18 +00:00
# Renderers (only set these if you have studied the source and understand
# the inner workings)
' formset_renderers ' : {
2015-11-02 20:44:18 +00:00
' default ' : ' bootstrap3.renderers.FormsetRenderer ' ,
} ,
' form_renderers ' : {
' default ' : ' bootstrap3.renderers.FormRenderer ' ,
} ,
' field_renderers ' : {
' default ' : ' bootstrap3.renderers.FieldRenderer ' ,
' inline ' : ' bootstrap3.renderers.InlineFieldRenderer ' ,
} ,
}
# djangocms_blog config
BLOG_ENABLE_COMMENTS = False
BLOG_USE_PLACEHOLDER = True
2015-11-05 07:02:18 +00:00
BLOG_IMAGE_THUMBNAIL_SIZE = { ' size ' : ' 120x120 ' , ' crop ' : True , ' upscale ' : False }
BLOG_IMAGE_FULL_SIZE = { ' size ' : ' 640x120 ' , ' crop ' : True , ' upscale ' : False }
2015-11-02 20:44:18 +00:00
BLOG_PAGINATION = 4
BLOG_LATEST_POSTS = BLOG_PAGINATION
BLOG_POSTS_LIST_TRUNCWORDS_COUNT = 100
BLOG_MULTISITE = True
BLOG_AUTHOR_DEFAULT = True
2015-11-05 07:02:18 +00:00
# django-meta
2015-11-02 20:44:18 +00:00
META_SITE_PROTOCOL = " https "
META_SITE_DOMAIN = " ungleich.ch "
META_SITE_TYPE = " website "
META_SITE_NAME = " ungleich "
2015-11-05 07:02:18 +00:00
META_INCLUDE_KEYWORDS = [ " ungleich " , " hosting " , " switzerland " ,
" Schweiz " , " Swiss " , " cdist " ]
2015-11-02 20:44:18 +00:00
META_USE_SITES = True
2015-11-05 07:02:18 +00:00
2016-03-05 19:57:41 +00:00
PARLER_LANGUAGES = { 1 : ( { ' code ' : ' en-us ' } , { ' code ' : ' de ' } , ) }
2016-03-07 17:39:24 +00:00
AUTH_USER_MODEL = ' membership.CustomUser '
2016-03-11 18:42:45 +00:00
# PAYMENT
STRIPE_DESCRIPTION_ON_PAYMENT = " Payment for ungleich GmbH services "
# EMAIL MESSAGES
REGISTRATION_MESSAGE = { ' subject ' : " Validation mail " ,
2016-05-07 21:05:46 +00:00
' message ' : ' Thank You for registering for account on Digital Glarus. \n Please verify Your account under following link http:// {host} /en-us/digitalglarus/login/validate/ {slug} ' ,
}
STRIPE_API_PRIVATE_KEY = env ( ' STRIPE_API_PRIVATE_KEY ' )
STRIPE_API_PUBLIC_KEY = env ( ' STRIPE_API_PUBLIC_KEY ' )
2016-03-15 23:26:49 +00:00
2016-05-19 06:17:16 +00:00
DEBUG = True
2016-03-15 23:26:49 +00:00
2016-03-22 21:09:22 +00:00
if DEBUG :
from . local import *
else :
from . prod import *