Merge branch 'release/ungleich-fixes'
This commit is contained in:
		
				commit
				
					
						b5f827ad01
					
				
			
		
					 12 changed files with 102 additions and 85 deletions
				
			
		
							
								
								
									
										4
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -28,3 +28,7 @@ ungleich.db
 | 
			
		|||
*~*
 | 
			
		||||
 | 
			
		||||
secret-key
 | 
			
		||||
 | 
			
		||||
.idea/
 | 
			
		||||
 | 
			
		||||
.env
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ def blog(request):
 | 
			
		|||
 | 
			
		||||
def blog_detail(request, slug):
 | 
			
		||||
    language = get_language()
 | 
			
		||||
    post = Post.objects.translated(language, slug=slug).language(language).get()
 | 
			
		||||
    post = Post.objects.translated('en-us', slug=slug).get()
 | 
			
		||||
    context = {
 | 
			
		||||
        'post': post,
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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',
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -5,25 +5,28 @@ 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/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ADMINS = (
 | 
			
		||||
    ('Nico Schottelius', 'nico.schottelius@ungleich.ch'),
 | 
			
		||||
)
 | 
			
		||||
#    ('Sanghee Kim', 'sanghee.kim@ungleich.ch'),
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MANAGERS = ADMINS
 | 
			
		||||
 | 
			
		||||
SITE_ID = 1
 | 
			
		||||
 | 
			
		||||
APP_ROOT_ENDPOINT = "/"
 | 
			
		||||
| 
						 | 
				
			
			@ -35,18 +38,7 @@ 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" ,
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
SECRET_KEY = env('DJANGO_SECRET_KEY')
 | 
			
		||||
 | 
			
		||||
# Application definition
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +108,6 @@ MIDDLEWARE_CLASSES = (
 | 
			
		|||
    'cms.middleware.toolbar.ToolbarMiddleware',
 | 
			
		||||
    'cms.middleware.language.LanguageCookieMiddleware',
 | 
			
		||||
)
 | 
			
		||||
#    'django.middleware.security.SecurityMiddleware',
 | 
			
		||||
 | 
			
		||||
ROOT_URLCONF = 'dynamicweb.urls'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -155,15 +146,13 @@ TEMPLATE_CONTEXT_PROCESSORS = (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
TEMPLATE_DIRS = (
 | 
			
		||||
    os.path.join(BASE_DIR, 'templates'),
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
    LOGIN_URL = APP_ROOT_ENDPOINT + 'accounts/login/'
 | 
			
		||||
if LOGOUT_URL is None:
 | 
			
		||||
| 
						 | 
				
			
			@ -285,16 +267,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 files.
 | 
			
		||||
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'
 | 
			
		||||
| 
						 | 
				
			
			@ -343,7 +324,9 @@ THUMBNAIL_PROCESSORS = (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
# 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_ATTRIBUTES = ('scrolling', 'allowfullscreen', 'frameborder')
 | 
			
		||||
USE_X_FORWARDED_HOST = True
 | 
			
		||||
| 
						 | 
				
			
			@ -358,19 +341,23 @@ BOOTSTRAP3 = {
 | 
			
		|||
    # 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)
 | 
			
		||||
    # 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)
 | 
			
		||||
    # 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)
 | 
			
		||||
    # 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 with Bootstrap JavaScript
 | 
			
		||||
    # (affects django-bootstrap3 template tags)
 | 
			
		||||
    'include_jquery': False,
 | 
			
		||||
 | 
			
		||||
    # Label class to use in horizontal forms
 | 
			
		||||
| 
						 | 
				
			
			@ -394,10 +381,12 @@ BOOTSTRAP3 = {
 | 
			
		|||
    # 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)
 | 
			
		||||
    # 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)
 | 
			
		||||
    # Renderers (only set these if you have studied the source and understand
 | 
			
		||||
    # the inner workings)
 | 
			
		||||
    'formset_renderers': {
 | 
			
		||||
        'default': 'bootstrap3.renderers.FormsetRenderer',
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			@ -427,10 +416,8 @@ 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_INCLUDE_KEYWORDS = ["ungleich", "hosting", "switzerland",
 | 
			
		||||
                         "Schweiz", "Swiss", "cdist"]
 | 
			
		||||
META_USE_SITES = True
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    from .local.local_settings import *
 | 
			
		||||
except ImportError as e:
 | 
			
		||||
    pass
 | 
			
		||||
PARLER_LANGUAGES = {1: ({'code': 'en-us'}, {'code': 'de'}, )}
 | 
			
		||||
							
								
								
									
										21
									
								
								dynamicweb/settings/local.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								dynamicweb/settings/local.py
									
										
									
									
									
										Normal 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
 | 
			
		||||
							
								
								
									
										15
									
								
								dynamicweb/settings/prod.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								dynamicweb/settings/prod.py
									
										
									
									
									
										Normal 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" ,
 | 
			
		||||
]
 | 
			
		||||
| 
						 | 
				
			
			@ -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 = [
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,3 +56,6 @@ gevent>=1.1a2
 | 
			
		|||
djangocms-page-meta
 | 
			
		||||
# memcache
 | 
			
		||||
pylibmc
 | 
			
		||||
 | 
			
		||||
# .env
 | 
			
		||||
django-dotenv
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@
 | 
			
		|||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    {% cms_toolbar %}
 | 
			
		||||
    {% show_menu 0 1 100 100 "cms/ungleichch/_menu.html" %}
 | 
			
		||||
    {% show_menu 0 0 0 1 "cms/ungleichch/_menu.html" %}
 | 
			
		||||
    <!-- body -->
 | 
			
		||||
    <!-- Main Content -->
 | 
			
		||||
    {% block base_header %}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue