From 05c8bf3d372ddd0e1c0c24aafe9a20603f7da08a Mon Sep 17 00:00:00 2001 From: rscnt Date: Mon, 2 Nov 2015 14:41:21 -0600 Subject: [PATCH 1/8] dynamicweb: deleted old settings files Signed-off-by: rscnt --- dynamicweb/local/__init__.py | 0 dynamicweb/local/local_settings.py.example | 13 - dynamicweb/settings.py | 436 --------------------- 3 files changed, 449 deletions(-) delete mode 100644 dynamicweb/local/__init__.py delete mode 100644 dynamicweb/local/local_settings.py.example delete mode 100644 dynamicweb/settings.py diff --git a/dynamicweb/local/__init__.py b/dynamicweb/local/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/dynamicweb/local/local_settings.py.example b/dynamicweb/local/local_settings.py.example deleted file mode 100644 index aa97b091..00000000 --- a/dynamicweb/local/local_settings.py.example +++ /dev/null @@ -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', - } -} diff --git a/dynamicweb/settings.py b/dynamicweb/settings.py deleted file mode 100644 index 442a1f82..00000000 --- a/dynamicweb/settings.py +++ /dev/null @@ -1,436 +0,0 @@ -""" -Copyright 2015 ungleich. -""" - -# -*- coding: utf-8 -*- -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -import os -import logging -import django.db.backends.postgresql_psycopg2 -from django.utils.translation import ugettext_lazy as _ - -gettext = lambda s: s -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -# Quick-start development settings - unsuitable for production -# 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 - -APP_ROOT_ENDPOINT = "/" - -LOGIN_URL = None -LOGOUT_URL = None -LOGIN_REDIRECT_URL = None - -EMAIL_HOST="localhost" -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" , -] - - -# Application definition - -INSTALLED_APPS = ( - 'djangocms_admin_style', - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.sites', - 'cms', # django CMS itself - 'treebeard', # utilities for implementing a tree - 'menus', # helper for model independent hierarchical website navigation - 'sekizai', # for javascript and css management - #django-cms plugins - 'djangocms_flash', - 'djangocms_googlemap', - 'djangocms_inherit', - 'djangocms_link', - 'djangocms_snippet', - 'djangocms_teaser', - 'djangocms_page_meta', - #django-filer - 'cmsplugin_filer_file', - 'cmsplugin_filer_folder', - 'cmsplugin_filer_link', - 'cmsplugin_filer_teaser', - 'cmsplugin_filer_video', - # versioning - 'reversion', - #ck-editor - 'djangocms_text_ckeditor', - # djangocms-blog - 'filer', - 'easy_thumbnails', - 'cmsplugin_filer_image', - 'parler', - 'taggit', - 'taggit_autosuggest', - 'django_select2', - 'meta', - 'meta_mixin', - 'admin_enhancer', - 'djangocms_blog', - 'bootstrap3', - 'compressor', - # ungleich - 'ungleich', - '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', -) -# 'django.middleware.security.SecurityMiddleware', - -ROOT_URLCONF = 'dynamicweb.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - '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', - ], - }, - }, -] - -WSGI_APPLICATION = 'dynamicweb.wsgi.application' - -# Deprecated since version 1.8. -# callables take a request object as their argument and return a dictionary of -# items to be merged into the context. -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.contrib.auth.context_processors.auth", - "django.core.context_processors.debug", - "django.core.context_processors.i18n", - "django.core.context_processors.media", - "django.core.context_processors.static", - "django.core.context_processors.tz", - "django.contrib.messages.context_processors.messages", - "django.core.context_processors.request", - 'sekizai.context_processors.sekizai', - 'cms.context_processors.cms_settings', -) - -TEMPLATE_DIRS = ( - os.path.join(BASE_DIR, 'templates'), -) - -CMS_TEMPLATES_DIR = { - 1: os.path.join(TEMPLATE_DIRS[0], 'cms/'), -} - - - -# Database -# https://docs.djangoproject.com/en/1.8/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'app', - } -} - -# 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' - -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': { - 'name' : _('Content'), - 'default_plugins':[ - { - 'plugin_type':'TextPlugin', - 'values':{'body':'

'}, - }, - ] - }, - 'post_content': { - 'name' : _('Content'), - 'default_plugins':[ - { - 'plugin_type':'TextPlugin', - 'values':{'body':'

'}, - }, - ] - }, -} - -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', - 'LOCATION': '127.0.0.1:11211', - } -} - -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: - LOGIN_URL = APP_ROOT_ENDPOINT + 'accounts/login/' -if LOGOUT_URL is None: - LOGOUT_URL = APP_ROOT_ENDPOINT + 'accounts/logout/' -if LOGIN_REDIRECT_URL is None: - LOGIN_REDIRECT_URL = APP_ROOT_ENDPOINT - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.7/howto/static-files/ - -STATIC_URL = '/static/' - -STATIC_ROOT = os.path.join(BASE_DIR, 'static') - -# Media files. -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') -MEDIA_URL = APP_ROOT_ENDPOINT + 'media/' -FILE_UPLOAD_PERMISSIONS = 0o644 - -# Templates confs -TEMPLATE_DIRS = ( - os.path.join(BASE_DIR, "templates"), -) - -META_SITE_PROTOCOL = 'http' -META_USE_SITES = True - -MIGRATION_MODULES = { - 'cms': 'cms.migrations', - 'filer': 'filer.migrations_django', - 'menus': 'menus.migrations_django', - '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_snippet': 'djangocms_snippet.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', -) - -COMPRESS_PRECOMPILERS = ( - ('text/less', 'lesscpy {infile}'), -) - -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 -TEXT_SAVE_IMAGE_FUNCTION='cmsplugin_filer_image.integrations.ckeditor.create_image_plugin' -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/', - - # The complete URL to the Bootstrap CSS file (None means derive it from base_url) - 'css_url': None, - - # The complete URL to the Bootstrap CSS file (None means no theme) - 'theme_url': None, - - # The complete URL to the Bootstrap JavaScript file (None means derive it from base_url) - 'javascript_url': None, - - # Put JavaScript in the HEAD section of the HTML document (only relevant if you use bootstrap3.html) - 'javascript_in_head': False, - - # Include jQuery with Bootstrap JavaScript (affects django-bootstrap3 template tags) - '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', - - # Class to indicate success, meaning the field has valid input (better to set this in your Django form) - 'success_css_class': 'has-success', - - # Renderers (only set these if you have studied the source and understand the inner workings) - 'formset_renderers':{ - '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 -BLOG_IMAGE_THUMBNAIL_SIZE = {'size': '120x120', 'crop': True,'upscale': False} -BLOG_IMAGE_FULL_SIZE = {'size': '640x120', 'crop': True,'upscale': False} -BLOG_PAGINATION = 4 -BLOG_LATEST_POSTS = BLOG_PAGINATION -BLOG_POSTS_LIST_TRUNCWORDS_COUNT = 100 -BLOG_MULTISITE = True -BLOG_AUTHOR_DEFAULT = True - -#django-meta -META_SITE_PROTOCOL = "https" -META_SITE_DOMAIN = "ungleich.ch" -META_SITE_TYPE = "website" -META_SITE_NAME = "ungleich" -META_INCLUDE_KEYWORDS = ["ungleich", "hosting", "switzerland", "Schweiz", "Swiss", "cdist"] -META_USE_SITES = True - -try: - from .local.local_settings import * -except ImportError as e: - pass From 180ad09fab95019832f8d32f188983ea9d736442 Mon Sep 17 00:00:00 2001 From: rscnt Date: Mon, 2 Nov 2015 14:43:03 -0600 Subject: [PATCH 2/8] added django-dotenv to requirements.txt Signed-off-by: rscnt --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements.txt b/requirements.txt index 342be9cf..cdd1ee7f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -56,3 +56,6 @@ gevent>=1.1a2 djangocms-page-meta # memcache pylibmc + +# .env +django-dotenv From f885036d0ec7b86e8c37af969cf668dc1354f7b4 Mon Sep 17 00:00:00 2001 From: rscnt Date: Mon, 2 Nov 2015 14:44:18 -0600 Subject: [PATCH 3/8] dynamicweb: added settings module with different files for each env Signed-off-by: rscnt --- dynamicweb/settings/__init__.py | 0 dynamicweb/settings/base.py | 413 ++++++++++++++++++++++++++++++++ dynamicweb/settings/prod.py | 15 ++ manage.py | 2 +- 4 files changed, 429 insertions(+), 1 deletion(-) create mode 100644 dynamicweb/settings/__init__.py create mode 100644 dynamicweb/settings/base.py create mode 100644 dynamicweb/settings/prod.py diff --git a/dynamicweb/settings/__init__.py b/dynamicweb/settings/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py new file mode 100644 index 00000000..77d01d43 --- /dev/null +++ b/dynamicweb/settings/base.py @@ -0,0 +1,413 @@ +""" +Copyright 2015 ungleich. +""" + +# -*- coding: utf-8 -*- +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os +import logging +import django.db.backends.postgresql_psycopg2 +from django.utils.translation import ugettext_lazy as _ +# dotenv +import dotenv + +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__))) + +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 +# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ + +SITE_ID = 1 + +APP_ROOT_ENDPOINT = "/" + +LOGIN_URL = None +LOGOUT_URL = None +LOGIN_REDIRECT_URL = None + +EMAIL_HOST="localhost" +EMAIL_PORT=25 + +SECRET_KEY = env('DJANGO_SECRET_KEY') + +# Application definition + +INSTALLED_APPS = ( + 'djangocms_admin_style', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.sites', + 'cms', # django CMS itself + 'treebeard', # utilities for implementing a tree + 'menus', # helper for model independent hierarchical website navigation + 'sekizai', # for javascript and css management + #django-cms plugins + 'djangocms_flash', + 'djangocms_googlemap', + 'djangocms_inherit', + 'djangocms_link', + 'djangocms_snippet', + 'djangocms_teaser', + 'djangocms_page_meta', + #django-filer + 'cmsplugin_filer_file', + 'cmsplugin_filer_folder', + 'cmsplugin_filer_link', + 'cmsplugin_filer_teaser', + 'cmsplugin_filer_video', + # versioning + 'reversion', + #ck-editor + 'djangocms_text_ckeditor', + # djangocms-blog + 'filer', + 'easy_thumbnails', + 'cmsplugin_filer_image', + 'parler', + 'taggit', + 'taggit_autosuggest', + 'django_select2', + 'meta', + 'meta_mixin', + 'admin_enhancer', + 'djangocms_blog', + 'bootstrap3', + 'compressor', + # ungleich + 'ungleich', + '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', + 'DIRS': [], + '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', + ], + }, + }, +] + +WSGI_APPLICATION = 'dynamicweb.wsgi.application' + +# Deprecated since version 1.8. +# callables take a request object as their argument and return a dictionary of +# items to be merged into the context. +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.contrib.auth.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.static", + "django.core.context_processors.tz", + "django.contrib.messages.context_processors.messages", + "django.core.context_processors.request", + 'sekizai.context_processors.sekizai', + 'cms.context_processors.cms_settings', +) + +TEMPLATE_DIRS = ( + os.path.join(PROJECT_DIR, 'templates'), +) + +CMS_TEMPLATES_DIR = { + 1: os.path.join(TEMPLATE_DIRS[0], 'cms/'), +} + +# Database +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'app', + } +} + +# 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' + +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': { + 'name' : _('Content'), + 'default_plugins':[ + { + 'plugin_type':'TextPlugin', + 'values':{'body':'

'}, + }, + ] + }, + 'post_content': { + 'name' : _('Content'), + 'default_plugins':[ + { + 'plugin_type':'TextPlugin', + 'values':{'body':'

'}, + }, + ] + }, +} + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', + 'LOCATION': '127.0.0.1:11211', + } +} + +if LOGIN_URL is None: + LOGIN_URL = APP_ROOT_ENDPOINT + 'accounts/login/' +if LOGOUT_URL is None: + LOGOUT_URL = APP_ROOT_ENDPOINT + 'accounts/logout/' +if LOGIN_REDIRECT_URL is None: + LOGIN_REDIRECT_URL = APP_ROOT_ENDPOINT + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.7/howto/static-files/ + +STATIC_URL = '/static/' + +STATIC_ROOT = os.path.join(BASE_DIR, 'static') + +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +MEDIA_URL = APP_ROOT_ENDPOINT + 'media/' +FILE_UPLOAD_PERMISSIONS = 0o644 + +# Templates confs +TEMPLATE_DIRS = ( + os.path.join(BASE_DIR, "templates"), +) + +META_SITE_PROTOCOL = 'http' +META_USE_SITES = True + +MIGRATION_MODULES = { + 'cms': 'cms.migrations', + 'filer': 'filer.migrations_django', + 'menus': 'menus.migrations_django', + '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_snippet': 'djangocms_snippet.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', +) + +COMPRESS_PRECOMPILERS = ( + ('text/less', 'lesscpy {infile}'), +) + +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 +TEXT_SAVE_IMAGE_FUNCTION='cmsplugin_filer_image.integrations.ckeditor.create_image_plugin' +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/', + + # The complete URL to the Bootstrap CSS file (None means derive it from base_url) + 'css_url': None, + + # The complete URL to the Bootstrap CSS file (None means no theme) + 'theme_url': None, + + # The complete URL to the Bootstrap JavaScript file (None means derive it from base_url) + 'javascript_url': None, + + # Put JavaScript in the HEAD section of the HTML document (only relevant if you use bootstrap3.html) + 'javascript_in_head': False, + + # Include jQuery with Bootstrap JavaScript (affects django-bootstrap3 template tags) + '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', + + # Class to indicate success, meaning the field has valid input (better to set this in your Django form) + 'success_css_class': 'has-success', + + # Renderers (only set these if you have studied the source and understand the inner workings) + 'formset_renderers':{ + '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 +BLOG_IMAGE_THUMBNAIL_SIZE = {'size': '120x120', 'crop': True,'upscale': False} +BLOG_IMAGE_FULL_SIZE = {'size': '640x120', 'crop': True,'upscale': False} +BLOG_PAGINATION = 4 +BLOG_LATEST_POSTS = BLOG_PAGINATION +BLOG_POSTS_LIST_TRUNCWORDS_COUNT = 100 +BLOG_MULTISITE = True +BLOG_AUTHOR_DEFAULT = True + +#django-meta +META_SITE_PROTOCOL = "https" +META_SITE_DOMAIN = "ungleich.ch" +META_SITE_TYPE = "website" +META_SITE_NAME = "ungleich" +META_INCLUDE_KEYWORDS = ["ungleich", "hosting", "switzerland", "Schweiz", "Swiss", "cdist"] +META_USE_SITES = True diff --git a/dynamicweb/settings/prod.py b/dynamicweb/settings/prod.py new file mode 100644 index 00000000..3b385370 --- /dev/null +++ b/dynamicweb/settings/prod.py @@ -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" , +] diff --git a/manage.py b/manage.py index 6d3324f3..e350f7a5 100755 --- a/manage.py +++ b/manage.py @@ -3,7 +3,7 @@ import os import sys 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 cf9a9f082a7332b74cec9cd2bbec5137a39d87c6 Mon Sep 17 00:00:00 2001 From: rscnt Date: Mon, 2 Nov 2015 14:44:31 -0600 Subject: [PATCH 4/8] gitignore: added .idea folder and .env file Signed-off-by: rscnt --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 63b7ba8f..567f4900 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,7 @@ ungleich.db *~* secret-key + +.idea/ + +.env From ca3031dde21a74d16666b6287d189adc51e65ffe Mon Sep 17 00:00:00 2001 From: rscnt Date: Mon, 2 Nov 2015 14:45:04 -0600 Subject: [PATCH 5/8] dynamicweb/urls: fetch project settings instead of project settings module Signed-off-by: rscnt --- dynamicweb/urls.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dynamicweb/urls.py b/dynamicweb/urls.py index 10291fac..e42d0772 100644 --- a/dynamicweb/urls.py +++ b/dynamicweb/urls.py @@ -4,7 +4,7 @@ from django.contrib import admin from django.conf.urls.i18n import i18n_patterns from django.conf.urls.static import static -from dynamicweb import settings +from django.conf import settings from hosting.views import railshosting urlpatterns = [ @@ -25,6 +25,7 @@ urlpatterns += i18n_patterns('', if settings.DEBUG: urlpatterns += patterns('', + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT), url(r'^media/(?P.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, From 813db391cf20704595d4261899a37e20116e6d02 Mon Sep 17 00:00:00 2001 From: rscnt Date: Mon, 2 Nov 2015 14:45:32 -0600 Subject: [PATCH 6/8] dynamicweb/wsgi: using settings.prod module on production Signed-off-by: rscnt --- dynamicweb/wsgi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamicweb/wsgi.py b/dynamicweb/wsgi.py index 49f057b1..224ebf0f 100644 --- a/dynamicweb/wsgi.py +++ b/dynamicweb/wsgi.py @@ -11,6 +11,6 @@ import os 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() From be7579134f088358e1c15747fd40753ad4cdd84e Mon Sep 17 00:00:00 2001 From: rscnt Date: Mon, 2 Nov 2015 15:58:52 -0600 Subject: [PATCH 7/8] dynamicweb/settings: base, using PROJECT_ROOT instead of BASE_DIR Signed-off-by: rscnt --- dynamicweb/settings/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 77d01d43..356d5f41 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -268,15 +268,15 @@ if LOGIN_REDIRECT_URL is None: STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static') +STATIC_ROOT = os.path.join(PROJECT_DIR, 'static') -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media') MEDIA_URL = APP_ROOT_ENDPOINT + 'media/' FILE_UPLOAD_PERMISSIONS = 0o644 # Templates confs TEMPLATE_DIRS = ( - os.path.join(BASE_DIR, "templates"), + os.path.join(PROJECT_DIR, "templates"), ) META_SITE_PROTOCOL = 'http' From f5ca1934c047a639eff2a1bcd8ee00ac3d4b90d8 Mon Sep 17 00:00:00 2001 From: rscnt Date: Mon, 2 Nov 2015 16:02:39 -0600 Subject: [PATCH 8/8] dynamicweb/urls: removing static() call Signed-off-by: rscnt --- dynamicweb/urls.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dynamicweb/urls.py b/dynamicweb/urls.py index e42d0772..129058de 100644 --- a/dynamicweb/urls.py +++ b/dynamicweb/urls.py @@ -25,7 +25,6 @@ urlpatterns += i18n_patterns('', if settings.DEBUG: urlpatterns += patterns('', - static(settings.STATIC_URL, document_root=settings.STATIC_ROOT), url(r'^media/(?P.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT,