Skip to content

Instantly share code, notes, and snippets.

@dlamotte
Forked from ojii/example.html
Created June 15, 2011 01:37
Show Gist options
  • Select an option

  • Save dlamotte/1026323 to your computer and use it in GitHub Desktop.

Select an option

Save dlamotte/1026323 to your computer and use it in GitHub Desktop.
base settings for django-cms and gondor project
[gondor]
site_key =
vcs = hg
[app]
; this path is relative to your project root (the directory .gondor is in)
requirements_file = requirements.txt
; this is a Python path and the default value maps to deploy/wsgi.py on disk
wsgi_entry_point = wsgi
; can be either nashvegas, south or none
migrations = south
; whether or not to run collectstatic (or build_static if collectstatic is not
; available)
staticfiles = on
-e git+git://github.com/lamotte/django-cms.git@2bc137ab652686678626e0385af055e8e7352ca4#egg=django-cms
Django==1.3
PIL==1.1.7
South==0.7.3
django-debug-toolbar==0.8.5
django-mptt==0.4.2
django-tinymce==1.5.1a2
gondor==1.0b1.post10
# -*- coding: utf-8 -*-
import os
from imp import find_module
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '[email protected]'),
)
MANAGERS = ADMINS
LANGUAGES = [('en', 'en')]
DEFAULT_LANGUAGE = 0
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_DIR, 'base.db'),
}
}
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = False
USE_L10N = False
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_DIR, 'staticroot')
# Make this unique, and don't share it with anybody.
SECRET_KEY = ''
# 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',
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
MIDDLEWARE_CLASSES = (
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.contrib.messages.context_processors.messages',
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
)
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
#'SHOW_TOOLBAR_CALLBACK': show_toolbar,
#'EXTRA_SIGNALS': ['myproject.signals.MySignal'],
#'HIDE_DJANGO_SQL': False,
#'TAG': 'div',
}
DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
#'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
)
CMS_TEMPLATES = (
#('template.html', 'Template'),
)
TINYMCE_DEFAULT_CONFIG = {
'plugins': '-example',
'mode': 'textareas',
'theme': 'advanced',
'theme_advanced_blockformats': 'p,h1,h2,h3,blockquote,code',
'theme_advanced_buttons1':
'mylistbox,formatselect,mysplitbutton,bold,italic,underline,separator,' +
'strikethrough,justifyleft,justifycenter,justifyright,justifyfull,' +
'bullist,numlist,undo,redo,link,unlink',
'theme_advanced_buttons2': '',
'theme_advanced_buttons3': '',
'theme_advanced_toolbar_location': 'top',
'theme_advanced_toolbar_align': 'left',
'theme_advanced_statusbar_location': 'bottom',
}
ROOT_URLCONF = 'base.urls'
TEMPLATE_DIRS = (
os.path.join(PROJECT_DIR, 'templates'),
)
STATICFILES_DIRS = (
os.path.join(PROJECT_DIR, 'static'),
os.path.join(os.path.abspath(find_module('cms')[1]), 'media'),
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'debug_toolbar',
'cms',
'sekizai',
'menus',
'mptt',
'south',
'cms.plugins.text',
'cms.plugins.picture',
'cms.plugins.link',
'cms.plugins.file',
'cms.plugins.snippet',
'cms.plugins.googlemap',
'tinymce',
)
try:
from local_settings import *
except ImportError:
pass
CMS_MEDIA_ROOT = os.path.join(STATIC_ROOT, 'cms/')
CMS_MEDIA_URL = STATIC_URL + 'cms/'
<!doctype html>
{% load cms_tags sekizai_tags %}
<head>
<title>{{ request.current_page.get_title }}</title>
{% render_block "css" %}
</head>
<body>
{% if user.is_authenticated %}
{% cms_toolbar %}
{% endif %}
{% placeholder "main" %}
{% render_block "js" %}
</body>
</html>
from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
)
if settings.DEBUG:
# site_media/ is the prefix for deployments to gondor.io
media = dict(document_root=settings.MEDIA_ROOT)
static = dict(document_root=settings.STATIC_ROOT)
urlpatterns = patterns('django.contrib.staticfiles.views',
(r'^' + settings.STATIC_URL.lstrip('/') + '(.*)', 'serve', static),
(r'^site_media/' + settings.STATIC_URL.lstrip('/') + '(.*)', 'serve', static),
) + urlpatterns
urlpatterns = patterns('django.views.static',
(r'^' + settings.MEDIA_URL.lstrip('/') + '(.*)', 'serve', media),
(r'^site_media/' + settings.MEDIA_URL.lstrip('/') + '(.*)', 'serve', media),
) + urlpatterns
import os, sys
abspath = os.path.abspath
dirname = os.path.dirname
sys.path.insert(0, dirname(dirname(abspath(__file__))))
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'base.settings'
application = WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment