Permalink
Browse files

Fixing some issues, updated demo app to use django 1.3.1 and django-c…

…ms 2.2
  • Loading branch information...
1 parent 2d6a41c commit 65624105fd3b492b3f5d1cacd8fc3cd95038590a Mark Ransom committed Oct 29, 2011
Showing with 106 additions and 381 deletions.
  1. +4 −4 cms_themes/__init__.py
  2. +5 −2 demo/manage.py
  3. +0 −1 demo/media/themes
  4. +0 −3 demo/requirements.txt
  5. +91 −99 demo/settings.py
  6. +0 −268 demo/templates/base.html
  7. +0 −1 demo/templates/home.html
  8. +6 −3 demo/urls.py
View
@@ -3,8 +3,6 @@
import random
import os
-from django.conf import settings
-
def init_themes():
from django.contrib.sites.models import Site
from cms.conf.patch import post_patch
@@ -33,15 +31,17 @@ def set_themes():
for theme_dir in os.listdir(settings.THEMES_DIR):
if theme_dir in themes or not themes:
theme_full_path = os.path.join(settings.THEMES_DIR, theme_dir)
- if 'templates' in os.listdir(theme_full_path):
+ if os.path.isdir(theme_full_path) and 'templates' in os.listdir(theme_full_path):
template_path = os.path.join(theme_full_path, 'templates')
for template in os.listdir(template_path):
template_path = os.path.join(theme_dir, 'templates', template)
- theme_templates.append((template_path, '%s (%s)' % (template, theme_dir)))
+ template_display = '%s (%s)' % (template.replace('_', ' ').title().split('.')[0], theme_dir)
+ theme_templates.append((template_path, template_display))
setattr(settings, 'CMS_TEMPLATES', tuple(theme_templates) + settings.DEFAULT_CMS_TEMPLATES)
try:
+ from django.conf import settings
init_themes()
set_themes()
except ImportError:
View
@@ -1,11 +1,14 @@
#!/usr/bin/env python
from django.core.management import execute_manager
+import imp
try:
- import settings # Assumed to be in the same directory.
+ imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+ sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
sys.exit(1)
+import settings
+
if __name__ == "__main__":
execute_manager(settings)
View
View
@@ -1,3 +0,0 @@
-django==1.3.1
-django-cms
-south
View
@@ -1,28 +1,27 @@
-# Django settings for demo project.
-import os
-PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
+# Django settings for cmsdemo2 project.
+import os
gettext = lambda s: s
+PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
- # ('Your Name', 'your_email@domain.com'),
+ # ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
- 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': 'demo.db', # Or path to database file if using sqlite3.
- 'USER': '', # Not used with sqlite3.
- 'PASSWORD': '', # Not used with sqlite3.
- 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
- 'PORT': '', # Set to empty string for default. Not used with sqlite3.
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(PROJECT_DIR, 'database.sqlite'),
}
}
+CMS_TEMPLATES = (
+ ('blank.html', 'Blank'),
+)
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -48,132 +47,125 @@
USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
-# Example: "/home/media/media.lawrence.com/"
+# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_DIR, "media")
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = '/media/'
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/media/admin/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = '*^aor)8+d(lg_#ezg0&8sc&&pju^18#t=clw-2ief&q#+%(s*n'
-
-LANGUAGE_CODE = 'en'
-
-CMS_TEMPLATES = (
- ('home.html', gettext('Homepage')),
+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 = os.path.join(PROJECT_DIR, "static")
+STATIC_URL = "/static/"
+ADMIN_MEDIA_PREFIX = "/static/admin/"
+
+# 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.
)
-CMS_PLACEHOLDER_CONF = {
- 'footer-address-content': {
- 'plugins': ('TextPlugin',),
- 'name':gettext('Footer Link List'),
- },
- 'footer-link-list': {
- 'plugins': ('FilerImagePlugin',),
- 'name':gettext('Footer Link List'),
- },
- 'right-image': {
- 'plugins': ('FilerImagePlugin',),
- 'name':gettext('Right Image'),
- },
-}
-
-LANGUAGES = (
- ('en', gettext('English')),
+# 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',
)
-CMS_LANGUAGES = LANGUAGES
-
-GOOGLE_MAPS_API_KEY = ""
-
-CMS_SHOW_END_DATE = True
-CMS_SHOW_START_DATE = True
-CMS_PERMISSION = True
-CMS_MODERATOR = False
-CMS_URL_OVERWRITE = True
-CMS_MENU_TITLE_OVERWRITE = True
-CMS_SEO_FIELDS = True
-CMS_REDIRECTS = True
-CMS_SOFTROOT = True
-
-DEBUG_TOOLBAR_CONFIG = {
- "INTERCEPT_REDIRECTS" : False,
-}
-
-# Allowed IPs for the Django Debug Toolbar
-INTERNAL_IPS = ('127.0.0.1',)
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 'dan+40ima*torfgx3#!_wd3#vw_&kxo@$5@8=7t&mr5vb-&vjl'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.load_template_source',
- 'django.template.loaders.app_directories.load_template_source',
- 'django.template.loaders.eggs.load_template_source',
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+# 'django.template.loaders.eggs.Loader',
)
-TEMPLATE_CONTEXT_PROCESSORS = (
- "django.core.context_processors.auth",
- 'django.core.context_processors.debug',
- "django.core.context_processors.i18n",
- "django.core.context_processors.request",
- "django.core.context_processors.media",
- "cms.context_processors.media",
- 'django.contrib.messages.context_processors.messages',
-)
-
-
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',
+ #'cms.middleware.multilingual.MultilingualURLMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
- 'cms.middleware.media.PlaceholderMediaMiddleware',
)
ROOT_URLCONF = 'demo.urls'
-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.
- os.path.join(PROJECT_DIR,'templates'),
- os.path.join(PROJECT_DIR,'themes'),
+TEMPLATE_CONTEXT_PROCESSORS = (
+ 'django.contrib.auth.context_processors.auth',
+ 'django.core.context_processors.i18n',
+ 'django.core.context_processors.request',
+ 'django.core.context_processors.media',
+ 'django.core.context_processors.static',
+ 'cms.context_processors.media',
+ 'sekizai.context_processors.sekizai',
)
-FIXTURE_DIRS = (
- os.path.join(PROJECT_DIR, "fixtures"),
+TEMPLATE_DIRS = (
+ # The docs say it should be absolute path: PROJECT_DIR is precisely one.
+ # Life is wonderful!
+ os.path.join(PROJECT_DIR, "templates"),
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ # Uncomment the next line to enable the admin:
'django.contrib.admin',
+ # Uncomment the next line to enable admin documentation:
+ # 'django.contrib.admindocs',
'cms',
- 'menus',
+ 'cms.plugins.file',
+ 'cms.plugins.picture',
+ 'cms.plugins.flash',
+ 'cms.plugins.googlemap',
+ 'cms.plugins.link',
+ 'cms.plugins.snippet',
+ 'cms.plugins.teaser',
'cms.plugins.text',
+ 'cms.plugins.video',
+ 'cms.plugins.twitter',
'mptt',
- 'publisher',
+ 'menus',
'south',
- 'appmedia',
+ 'sekizai',
'cms_themes',
)
-
-SOUTH_TESTS_MIGRATE = False
-
-try:
- from settings_dev import *
-except ImportError:
- pass
+LANGUAGES = [
+ ('en', 'English'),
+]
+
+# 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.
+# 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,
+ 'handlers': {
+ 'mail_admins': {
+ 'level': 'ERROR',
+ 'class': 'django.utils.log.AdminEmailHandler'
+ }
+ },
+ 'loggers': {
+ 'django.request': {
+ 'handlers': ['mail_admins'],
+ 'level': 'ERROR',
+ 'propagate': True,
+ },
+ }
+}
Oops, something went wrong.

0 comments on commit 6562410

Please sign in to comment.