Commit 58a46b8b by benjaoming

Refactore testproject.settings to accommodate more scenarios

parent a4e3ebfb
......@@ -6,6 +6,9 @@ that you have checked out the root of the Git repository.
It comes with a prepopulated SQLite database.
Test settings
-------------
Setup
-----
......@@ -14,6 +17,15 @@ You should link your wiki and django_notify folders like so
ln -s ../wiki .
ln -s ../django_notify .
Running
-------
You should be able to immediately run it like this:
python manage.py runserver --settings=testproject.settings.local
The settings come in a package to administer several test scenarios. For simple purposes, simply edit `local.py`.
Login
-----
......
import haystack
haystack.autodiscover()
# -*- coding: utf-8 -*-
from os import path as os_path
PROJECT_PATH = os_path.abspath(os_path.split(__file__)[0])
PROJECT_PATH = os_path.abspath(os_path.split(os_path.dirname(__file__))[0])
DEBUG = True
TEMPLATE_DEBUG = DEBUG
......@@ -9,9 +9,6 @@ ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
#from django.core.urlresolvers import reverse_lazy
#LOGIN_REDIRECT_URL = reverse_lazy('wiki:get', kwargs={'path': ''})
MANAGERS = ADMINS
DATABASES = {
......@@ -21,12 +18,6 @@ DATABASES = {
}
}
#Django Haystack
HAYSTACK_SEARCH_ENGINE = 'whoosh'
HAYSTACK_WHOOSH_PATH = os_path.join(PROJECT_PATH, 'index_woosh')
HAYSTACK_SITECONF = 'testproject.search_sites'
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE = 'Europe/Copenhagen'
......@@ -52,15 +43,13 @@ STATICFILES_FINDERS = (
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
SECRET_KEY = 'b^fv_)t39h%9p40)fnkfblo##jkr!$0)lkp6bpy!fi*f$4*92!'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
MIDDLEWARE_CLASSES = [
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
......@@ -68,7 +57,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
]
ROOT_URLCONF = 'testproject.urls'
......@@ -79,7 +68,7 @@ TEMPLATE_DIRS = (
os_path.join(PROJECT_PATH, 'templates'),
)
TEMPLATE_CONTEXT_PROCESSORS =(
TEMPLATE_CONTEXT_PROCESSORS = [
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
......@@ -90,9 +79,9 @@ TEMPLATE_CONTEXT_PROCESSORS =(
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
'sekizai.context_processors.sekizai',
)
]
INSTALLED_APPS = (
INSTALLED_APPS = [
'django.contrib.humanize',
'django.contrib.auth',
'django.contrib.contenttypes',
......@@ -114,8 +103,7 @@ INSTALLED_APPS = (
'wiki.plugins.attachments',
'wiki.plugins.notifications',
'mptt',
'haystack',
)
]
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
......@@ -150,9 +138,10 @@ WIKI_ANONYMOUS_WRITE = True
WIKI_ANONYMOUS_CREATE = False
# Do not user /accounts/profile as default
LOGIN_REDIRECT_URL = "/"
#LOGIN_REDIRECT_URL = "/"
from django.core.urlresolvers import reverse_lazy
LOGIN_REDIRECT_URL = reverse_lazy('wiki:get', kwargs={'path': ''})
from settings_local import *
try:
import debug_toolbar #@UnusedImport
......
from testproject.settings import *
from testproject.settings.local import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': os_path.join(PROJECT_PATH, 'db', 'prepopulated-customauthuser.db'), # Or path to database file if using sqlite3.
}
}
INSTALLED_APPS = INSTALLED_APPS + [
# Test application for testing custom users
'wiki.tests.testdata',
]
AUTH_USER_MODEL = 'testdata.CustomUser'
\ No newline at end of file
from testproject.settings import *
from testproject.settings.local import *
import os
#Django Haystack
HAYSTACK_WHOOSH_PATH = os.path.join(PROJECT_PATH, 'index_woosh')
INSTALLED_APPS += ['haystack', 'wiki.plugins.haystack']
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
}
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(PROJECT_PATH, 'whoosh_index'),
},
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment