settings, change all tuples to list and use explicit extend

This commit is contained in:
nitely 2015-07-12 19:38:17 -03:00
parent ef6983ce68
commit b2f1cdf29f
7 changed files with 39 additions and 52 deletions

View File

@ -10,34 +10,33 @@ import sys
from spirit.settings import * from spirit.settings import *
# You may override spirit settings below... # You may override or extend spirit settings below...
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# Application definition # Application definition
# Extend the Spirit installed apps (notice the plus sign) # Extend the Spirit installed apps.
# Check out the spirit.settings.py so you do not end up with duplicate apps. # Check out the spirit.settings.py so you do not end up with duplicated apps.
INSTALLED_APPS += ( INSTALLED_APPS.extend([
# 'my_app1', # 'my_app1',
# 'my_app2', # 'my_app2',
) ])
# same here, check out the spirit.settings.py # same here, check out the spirit.settings.py
MIDDLEWARE_CLASSES += ( MIDDLEWARE_CLASSES.extend([
# 'my_middleware1', # 'my_middleware1',
# 'my_middleware2', # 'my_middleware2',
) ])
# same here # same here
TEMPLATES[0]['OPTIONS']['context_processors'] += [ TEMPLATES[0]['OPTIONS']['context_processors'].extend([
# 'my_template_proc1', # 'my_template_proc1',
# 'my_template_proc2', # 'my_template_proc2',
] ])
# same here (we update the Spirit caches) # same here (we update the Spirit caches)
CACHES.update({ CACHES.update({

View File

@ -23,9 +23,9 @@ SECRET_KEY = "DEV"
ALLOWED_HOSTS = ['127.0.0.1', ] ALLOWED_HOSTS = ['127.0.0.1', ]
INSTALLED_APPS += ( INSTALLED_APPS.extend([
'debug_toolbar', 'debug_toolbar',
) ])
DATABASES = { DATABASES = {
'default': { 'default': {
@ -40,8 +40,8 @@ CACHES.update({
}, },
}) })
PASSWORD_HASHERS = ( PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher', 'django.contrib.auth.hashers.MD5PasswordHasher',
) ]
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

View File

@ -23,11 +23,11 @@ SECRET_KEY = os.environ.get("SECRET_KEY", "")
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['.example.com', ] ALLOWED_HOSTS = ['.example.com', ]
# Extend the Spirit installed apps (notice the plus sign) # Extend the Spirit installed apps
# Check out the .base.py file for more examples # Check out the .base.py file for more examples
INSTALLED_APPS += ( INSTALLED_APPS.extend([
# 'my_app1', # 'my_app1',
) ])
# https://docs.djangoproject.com/en/dev/ref/settings/#databases # https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = { DATABASES = {
@ -44,12 +44,12 @@ DATABASES = {
# These are all the languages Spirit provides. # These are all the languages Spirit provides.
# https://www.transifex.com/projects/p/spirit/ # https://www.transifex.com/projects/p/spirit/
gettext_noop = lambda s: s gettext_noop = lambda s: s
LANGUAGES = ( LANGUAGES = [
('de', gettext_noop('German')), ('de', gettext_noop('German')),
('en', gettext_noop('English')), ('en', gettext_noop('English')),
('es', gettext_noop('Spanish')), ('es', gettext_noop('Spanish')),
('sv', gettext_noop('Swedish')), ('sv', gettext_noop('Swedish')),
) ]
# Default language # Default language
LANGUAGE_CODE = 'en' LANGUAGE_CODE = 'en'

View File

@ -12,9 +12,9 @@ from .base import *
SECRET_KEY = "TEST" SECRET_KEY = "TEST"
INSTALLED_APPS += ( INSTALLED_APPS.extend([
'spirit.core.tests', 'spirit.core.tests',
) ])
DATABASES = { DATABASES = {
'default': { 'default': {
@ -25,6 +25,6 @@ DATABASES = {
ROOT_URLCONF = 'example.project.urls' ROOT_URLCONF = 'example.project.urls'
PASSWORD_HASHERS = ( PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher', 'django.contrib.auth.hashers.MD5PasswordHasher',
) ]

View File

@ -37,9 +37,7 @@ ST_UNIQUE_EMAILS = True
# Django & Spirit settings defined below... # Django & Spirit settings defined below...
# #
# TODO: change all tuples to list so we can do .extend(arg1, arag2, ...) INSTALLED_APPS = [
INSTALLED_APPS = (
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
@ -49,8 +47,8 @@ INSTALLED_APPS = (
'spirit', 'spirit',
'spirit.core', 'spirit.core',
# 'spirit.tests' # 'spirit.core.tests'
) ]
# python manage.py createcachetable # python manage.py createcachetable
CACHES = { CACHES = {
@ -60,15 +58,15 @@ CACHES = {
}, },
} }
AUTHENTICATION_BACKENDS = ( AUTHENTICATION_BACKENDS = [
'spirit.user.auth.backends.UsernameAuthBackend', 'spirit.user.auth.backends.UsernameAuthBackend',
'spirit.user.auth.backends.EmailAuthBackend', 'spirit.user.auth.backends.EmailAuthBackend',
) ]
LOGIN_URL = 'spirit:user:auth:login' LOGIN_URL = 'spirit:user:auth:login'
LOGIN_REDIRECT_URL = 'spirit:user:update' LOGIN_REDIRECT_URL = 'spirit:user:update'
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = [
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware', 'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
@ -82,7 +80,7 @@ MIDDLEWARE_CLASSES = (
'spirit.user.middleware.LastSeenMiddleware', 'spirit.user.middleware.LastSeenMiddleware',
'spirit.user.middleware.ActiveUserMiddleware', 'spirit.user.middleware.ActiveUserMiddleware',
'spirit.core.middleware.PrivateForumMiddleware', 'spirit.core.middleware.PrivateForumMiddleware',
) ]
TEMPLATES = [ TEMPLATES = [
{ {
@ -110,13 +108,13 @@ TEMPLATES = [
# django-djconfig # django-djconfig
INSTALLED_APPS += ( INSTALLED_APPS += [
'djconfig', 'djconfig',
) ]
MIDDLEWARE_CLASSES += ( MIDDLEWARE_CLASSES += [
'djconfig.middleware.DjConfigMiddleware', 'djconfig.middleware.DjConfigMiddleware',
) ]
TEMPLATES[0]['OPTIONS']['context_processors'] += [ TEMPLATES[0]['OPTIONS']['context_processors'] += [
'djconfig.context_processors.config', 'djconfig.context_processors.config',
@ -124,9 +122,9 @@ TEMPLATES[0]['OPTIONS']['context_processors'] += [
# django-haystack # django-haystack
INSTALLED_APPS += ( INSTALLED_APPS += [
'haystack', 'haystack',
) ]
HAYSTACK_CONNECTIONS = { HAYSTACK_CONNECTIONS = {
'default': { 'default': {

View File

@ -12,9 +12,9 @@ from spirit.settings import *
SECRET_KEY = 'TEST' SECRET_KEY = 'TEST'
INSTALLED_APPS += ( INSTALLED_APPS += [
'spirit.core.tests', 'spirit.core.tests',
) ]
ROOT_URLCONF = 'spirit.urls' ROOT_URLCONF = 'spirit.urls'
@ -42,9 +42,9 @@ CACHES.update({
}) })
# speedup tests requiring login # speedup tests requiring login
PASSWORD_HASHERS = ( PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher', 'django.contrib.auth.hashers.MD5PasswordHasher',
) ]
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

View File

@ -10,17 +10,7 @@ import spirit.user.urls
import spirit.search.urls import spirit.search.urls
import spirit.category.urls import spirit.category.urls
import spirit.topic.urls import spirit.topic.urls
import spirit.topic.moderate.urls
import spirit.topic.unread.urls
import spirit.topic.notification.urls
import spirit.topic.favorite.urls
import spirit.topic.private.urls
import spirit.topic.poll.urls
import spirit.comment.urls import spirit.comment.urls
import spirit.comment.bookmark.urls
import spirit.comment.flag.urls
import spirit.comment.history.urls
import spirit.comment.like.urls
patterns = [ patterns = [