enable moderation in SimpleBackend
[astakos] / astakos / settings.py
1 # Django settings for astakos project.
2
3 from os.path import abspath, dirname, exists, join
4
5 PROJECT_PATH = dirname(abspath(__file__))
6
7 DEBUG = True
8 TEMPLATE_DEBUG = DEBUG
9
10 ADMINS = (
11     # ('Your Name', 'your_email@domain.com'),
12 )
13
14 MANAGERS = ADMINS
15
16 DATABASES = {
17     'default': {
18         'ENGINE': 'django.db.backends.sqlite3',
19         'NAME': join(PROJECT_PATH, 'astakos.db')
20     }
21 }
22
23 # Local time zone for this installation. Choices can be found here:
24 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
25 # although not all choices may be available on all operating systems.
26 # If running in a Windows environment this must be set to the same as your
27 # system time zone.
28 TIME_ZONE = 'UTC'
29
30 # Language code for this installation. All choices can be found here:
31 # http://www.i18nguy.com/unicode/language-identifiers.html
32 LANGUAGE_CODE = 'en-us'
33
34 SITE_ID = 1
35
36 # If you set this to False, Django will make some optimizations so as not
37 # to load the internationalization machinery.
38 USE_I18N = True
39
40 # If you set this to False, Django will not format dates, numbers and
41 # calendars according to the current locale
42 USE_L10N = True
43
44 # Absolute path to the directory that holds media.
45 # Example: "/home/media/media.lawrence.com/"
46 MEDIA_ROOT = ''
47
48 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
49 # trailing slash if there is a path component (optional in other cases).
50 # Examples: "http://media.lawrence.com", "http://example.com/media/"
51 MEDIA_URL = ''
52
53 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
54 # trailing slash.
55 # Examples: "http://foo.com/media/", "/media/".
56 ADMIN_MEDIA_PREFIX = '/media/'
57
58 # Make this unique, and don't share it with anybody.
59 SECRET_KEY = '$j0cdrfm*0sc2j+e@@2f-&3-_@2=^!z#+b-8o4_i10@2%ev7si'
60
61 # List of callables that know how to import templates from various sources.
62 TEMPLATE_LOADERS = (
63     'django.template.loaders.filesystem.Loader',
64     'django.template.loaders.app_directories.Loader',
65 )
66
67 MIDDLEWARE_CLASSES = (
68     'django.middleware.common.CommonMiddleware',
69     'django.middleware.csrf.CsrfViewMiddleware',
70     'django.contrib.sessions.middleware.SessionMiddleware',
71     'django.contrib.auth.middleware.AuthenticationMiddleware',
72     'django.contrib.messages.middleware.MessageMiddleware',
73     'astakos.middleware.LoggingConfigMiddleware',
74     'astakos.middleware.SecureMiddleware'
75 )
76
77 ROOT_URLCONF = 'astakos.urls'
78
79 TEMPLATE_DIRS = (
80     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
81     # Always use forward slashes, even on Windows.
82     # Don't forget to use absolute paths, not relative paths.
83     join(PROJECT_PATH, 'im/admin/templates/')
84 )
85
86 TEMPLATE_CONTEXT_PROCESSORS = (
87     'django.contrib.messages.context_processors.messages',
88     'django.contrib.auth.context_processors.auth',
89     'django.core.context_processors.i18n',
90     'django.core.context_processors.media',
91     'django.core.context_processors.request',
92     'astakos.im.context_processors.media',
93     'astakos.im.context_processors.im_modules',
94     'astakos.im.context_processors.next',
95     'astakos.im.context_processors.code',
96     'astakos.im.context_processors.invitations')
97
98 AUTHENTICATION_BACKENDS = ('astakos.im.auth_backends.EmailBackend',
99                             'astakos.im.auth_backends.TokenBackend')
100
101 CUSTOM_USER_MODEL = 'astakos.im.AstakosUser'
102
103 # Setup logging (use this name for the setting to avoid conflicts with django > 1.2.x).
104 LOGGING_SETUP = {
105     'version': 1,
106     'disable_existing_loggers': True,
107     'formatters': {
108         'simple': {
109             'format': '%(message)s'
110         },
111         'verbose': {
112             'format': '%(asctime)s [%(levelname)s] %(name)s %(message)s'
113         },
114     },
115     'handlers': {
116         'null': {
117             'class': 'logging.NullHandler',
118         },
119         'console': {
120             'class': 'logging.StreamHandler',
121             'formatter': 'verbose'
122         },
123     },
124     'loggers': {
125         'astakos': {
126             'handlers': ['console'],
127             'level': 'DEBUG' if DEBUG else 'INFO'
128         },
129     }
130 }
131
132 # The server is behind a proxy (apache and gunicorn setup).
133 USE_X_FORWARDED_HOST = False
134
135 # Set umask (needed for gunicorn setup).
136 #umask(0077)
137
138 # The URL where requests are redirected for login, especially when using the login_required() decorator.
139 LOGIN_URL = '/im'
140
141 conf = join(PROJECT_PATH, 'settings.local')
142 if exists(conf):
143     execfile(conf)
144 elif exists('/etc/astakos/settings.local'):
145     execfile('/etc/astakos/settings.local')
146
147 INSTALLED_APPS = (
148     'astakos.im',
149     'south',
150     'django.contrib.auth',
151     'django.contrib.contenttypes',
152     'django.contrib.messages',
153     'django.contrib.sites',
154     'django.contrib.sessions'
155 )