Skip to content

Instantly share code, notes, and snippets.

@darklow
Created March 3, 2014 11:06
Show Gist options
  • Save darklow/9322853 to your computer and use it in GitHub Desktop.
Save darklow/9322853 to your computer and use it in GitHub Desktop.
DjangoSuit.com whole project settings.py - https://github.com/darklow/django-suit-examples
import os
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__) + '/../')
ENV_ROOT = os.path.abspath(PROJECT_ROOT + '/../')
ADMINS = (
('XX', 'XXX@XXX.com'),
)
MANAGERS = ADMINS
DEFAULT_FROM_EMAIL = 'xxx@xxx.com'
SERVER_EMAIL = DEFAULT_FROM_EMAIL
DEBUG = False
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django_suit',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'locahost',
'PORT': '',
}
}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'Europe/Riga'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.abspath(PROJECT_ROOT + '/../../media/')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = PROJECT_ROOT + '/../../static/'
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'XXX'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
'djangosuit.apptemplates.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'djangosuit.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'djangosuit.wsgi.application'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
# "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Django suit, examples and web
'djangosuit',
'examples',
'suit',
'web',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'south',
'mptt',
'django_select2',
'suit_redactor',
'suit_ckeditor',
'reversion',
'import_export',
# Filer
'easy_thumbnails',
'filer',
# CMS
'cms',
'menus',
'sekizai',
'cms.plugins.file',
'cms.plugins.flash',
'cms.plugins.googlemap',
'cms.plugins.link',
'cms.plugins.picture',
'cms.plugins.snippet',
'cms.plugins.teaser',
'cms.plugins.text',
'cms.plugins.video',
'cms.plugins.twitter',
'cms.plugins.inherit',
'cmsplugin_filer_file',
'cmsplugin_filer_folder',
'cmsplugin_filer_image',
'cmsplugin_filer_teaser',
'cmsplugin_filer_video',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
# Add request to the templates
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
TEMPLATE_CONTEXT_PROCESSORS = TCP + (
'django.core.context_processors.request',
)
# Django Suit configuration
# Override any of following keys
SUIT_CONFIG = {
# 'ADMIN_NAME': 'Admin app name',
# 'HEADER_DATE_FORMAT': 'l, j. F Y',
# 'HEADER_TIME_FORMAT': 'H:i',
# forms
# 'SHOW_REQUIRED_ASTERISK': False, # Default True
# 'CONFIRM_UNSAVED_CHANGES': False, # Default True
# menu
'SEARCH_URL': 'admin:examples_country_changelist',
'MENU':(
# Rename app and set icon
{'app': 'examples', 'icon':'icon-leaf', 'models': (
'country', 'continent', 'kitchensink'
)},
{'label': 'Integrations', 'icon':'icon-globe', 'models': (
'examples.city', 'examples.category', 'examples.wysiwygeditor',
'examples.reversioneditem', 'examples.importexportitem'
)},
{'app': 'cms', 'label': 'Django CMS', 'icon': 'icon-file', 'models': (
'cms.page',
'snippet.snippet',
'cmsplugin_filer_image.thumbnailoption',
'sites.site',
)},
{'app': 'filer', 'label': 'Filer', 'icon': 'icon-picture',
'url': '/admin/filer/', 'models': (
{'model': 'filer.folder', 'label': 'Browse files'},
{'model': 'filer.folderpermission', 'label': 'Permissions'},
)},
# '-',
{'app': 'auth', 'models': ('user',), 'icon': 'icon-lock'},
{'label': 'Custom view', 'icon':'icon-cog', 'models': (
{'label': 'Custom link', 'url': '/admin/custom/'},
{'label': 'Check out error 404', 'url': '/admin/non-existant/'},
)},
),
# misc
'LIST_PER_PAGE': 15
}
AUTO_RENDER_SELECT2_STATICS = False
FILER_ENABLE_PERMISSIONS = True
THUMBNAIL_QUALITY = 100
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
#'easy_thumbnails.processors.scale_and_crop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)
# CMS
CMS_TEMPLATES = (
('template_1.html', 'Template One'),
# ('template_2.html', 'Template Two'),
)
MIDDLEWARE_CLASSES += (
'django.middleware.locale.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS += (
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
)
gettext = lambda s: s
LANGUAGES = (
('en', gettext('English')),
('fr', gettext('French')),
('ru', gettext('Russian')),
)
CMS_SHOW_START_DATE = True
CMS_SEO_FIELDS = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment