Commit 5895ad96 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

initial commit

parents
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+18 −0
Original line number Diff line number Diff line
# Python generated content
*.py[cod]

# CSS (generated by LESS)
**/static/css/*.css

# Development database & config
*.db
*.conf

# Upload directory
media/

# Setuptools generated
build/
dist/
setuptools-*
*.egg-info

MANIFEST.in

0 → 100644
+4 −0
Original line number Diff line number Diff line
include ez_setup.py
include manage.py
recursive-include static *
exclude static/css/*.css

kodo_sso/__init__.py

0 → 100644
+0 −0

Empty file added.

+72 −0
Original line number Diff line number Diff line
from os.path import dirname, join
from ..util.load_settings import *

PACKAGE_DIR = dirname(dirname(__file__))
BASE_DIR = dirname(PACKAGE_DIR)

SITE_ID = 1

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.sites',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.contenttypes',
)

MIDDLEWARE_CLASSES = (
	'django.middleware.cache.UpdateCacheMiddleware',
	'htmlmin.middleware.HtmlMinifyMiddleware',

	'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.cache.FetchFromCacheMiddleware',
	'htmlmin.middleware.MarkRequestMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
	'django.contrib.auth.context_processors.auth',
	'django.core.context_processors.i18n',
	'django.core.context_processors.request',
	'django.core.context_processors.debug',
)

ROOT_URLCONF = 'kodo_sso.urls'
WSGI_APPLICATION = 'kodo_sso.wsgi.application'


DEBUG = False


# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-gb'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATIC_URL = '/static/'
MEDIA_URL = '/media/'
ZINNIA_UPLOAD_TO = 'blog'

STATICFILES_DIRS = (
	join(PACKAGE_DIR, 'static'),
)

TEMPLATE_DIRS = (
	join(PACKAGE_DIR, 'templates'),
)
+76 −0
Original line number Diff line number Diff line
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
#
# ==============================================
# DO NOT EDIT THIS FILE TO CHANGE LOCAL SETTINGS
# ==============================================
#
# Use the file given by the environment variable DJANGO_DEV_SETTINGS (default: 
# dev.conf) to override settings for the development server.
#

from ..util.network import Network

# Fixed project settings (all environments)
from . import *

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'hjo$s%#k4(lf&-!tad0qeov51%k$@0n**1m9w*o91=v4k3ss$v'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = TEMPLATE_DEBUG = True
INTERNAL_IPS = Network('127.0.0.1')

CACHE_MIDDLEWARE_SECONDS = 0


# Email
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
ADMINS = (
	('Development Admin', 'admin@kodo.org.uk'),
)


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': join(BASE_DIR, 'dev.db'),
    }
}


# Media files
MEDIA_ROOT = join(BASE_DIR, 'media')


# Extra Development Middeware
from bs4 import BeautifulSoup
class BeautifulMiddleware(object):
	def process_response(self, request, response):
		if response.status_code == 200 \
		and response["content-type"].startswith("text/html"):
			beauty = BeautifulSoup(response.content, 'html5lib')
			response.content = beauty.prettify()
		return response

from django.utils.cache import add_never_cache_headers
class DisableClientSideCachingMiddleware(object):
	def process_response(self, request, response):
		add_never_cache_headers(response)
		return response

def class_name(klass):
	return '{0.__module__}.{0.__name__}'.format(klass)

MIDDLEWARE_CLASSES += (
	class_name(BeautifulMiddleware),
	class_name(DisableClientSideCachingMiddleware),
)


import os
config = os.environ.get('DJANGO_DEV_SETTINGS', 'dev.conf')
load_site(globals(), config)
import_from(globals(), os.environ.items())