Skip to content

Commit

Permalink
django 1.4 (and whoosh development version) compatibility for example…
Browse files Browse the repository at this point in the history
… project
  • Loading branch information
wardi committed Apr 11, 2012
1 parent 86ce145 commit 0c273f3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
43 changes: 21 additions & 22 deletions example/settings.py
Expand Up @@ -14,12 +14,15 @@

MANAGERS = ADMINS

DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'cms.db' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'cms.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
}
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
Expand All @@ -38,12 +41,6 @@
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
STATIC_URL = '/static/'

# Absolute path to the directory that holds pages media.
# PAGES_MEDIA_ROOT = os.path.join(STATIC_ROOT, 'pages', 'media', 'pages')
# Absolute path to the directory that holds media.
ADMIN_MEDIA_ROOT = os.path.join(STATIC_ROOT, 'admin_media')
ADMIN_MEDIA_PREFIX = '/admin_media/'


FIXTURE_DIRS = [os.path.join(PROJECT_DIR, 'fixtures')]

Expand All @@ -52,15 +49,12 @@

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
# this syntax is deprecated with django 1.2
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# could help
'django.template.loaders.eggs.load_template_source',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.i18n",
"django.core.context_processors.debug",
"django.core.context_processors.request",
Expand All @@ -78,6 +72,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'example.urls'
Expand All @@ -97,11 +92,11 @@
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.staticfiles',
'pages.testproj.documents',
'taggit',
'pages',
'mptt',
'staticfiles',
#'tinymce',
# disabled to make "setup.py test" to work properly
#'south',
Expand Down Expand Up @@ -171,9 +166,13 @@ def language_mapping(lang):
SITE_ID = 1
PAGE_USE_SITE_ID = False

HAYSTACK_SITECONF = 'example.search_sites'
HAYSTACK_SEARCH_ENGINE = 'whoosh'
HAYSTACK_WHOOSH_PATH = os.path.join(PROJECT_DIR, 'whoosh_index')
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
'INCLUDE_SPELLING': True,
},
}

PAGE_REAL_TIME_SEARCH = False

Expand Down
3 changes: 0 additions & 3 deletions example/urls.py
Expand Up @@ -3,7 +3,6 @@
from django.conf.urls.defaults import url, include, patterns
from django.conf.urls.defaults import handler404, handler500
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from pages.views import details

from pages.urlconf_registry import register_urlconf
Expand All @@ -22,8 +21,6 @@

)

urlpatterns += staticfiles_urlpatterns()

urlpatterns += patterns('',
# this gonna match /admin if someone forget the traling slash
(r'^', include('pages.urls')),
Expand Down
2 changes: 1 addition & 1 deletion pages/templates/admin/pages/page/change_list.html
Expand Up @@ -42,7 +42,7 @@
<div id="toolbar">
<form id="changelist-search" action="" method="post">
<div>
<label for="searchbar"><img src="{% load adminmedia %}{% admin_media_prefix %}img/admin/icon_searchbox.png" alt="{% trans "Search" %}" /></label>
<label for="searchbar"><img src="{{ STATIC_URL }}admin/img/icon_searchbox.png" alt="{% trans "Search" %}" /></label>
<input type="text" size="25" name="q" value="{{q}}" id="searchbar" />
<input type="submit" name="g" value="{% trans "Go" %}" />
</div>
Expand Down

0 comments on commit 0c273f3

Please sign in to comment.