settings.py 4.73 KB
Newer Older
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
1
# Django settings for astakos project.
2

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
3
from os.path import abspath, dirname, exists, join
4
5
6

PROJECT_PATH = dirname(abspath(__file__))

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
7
8
DEBUG = True
TEMPLATE_DEBUG = DEBUG
9

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
10
11
12
ADMINS = (
    # ('Your Name', 'your_email@domain.com'),
)
13

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': join(PROJECT_PATH, 'astakos.db')
    }
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'UTC'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# 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 = ''

# 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/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '$j0cdrfm*0sc2j+e@@2f-&3-_@2=^!z#+b-8o4_i10@2%ev7si'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'astakos.middleware.LoggingConfigMiddleware',
    'astakos.middleware.SecureMiddleware'
)

ROOT_URLCONF = 'astakos.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.
    join(PROJECT_PATH, 'im/admin/templates/')
)
85

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
86
87
88
89
90
91
92
TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.messages.context_processors.messages',
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.request',
    'astakos.im.context_processors.media',
93
    'astakos.im.context_processors.cloudbar',
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
94
95
96
97
98
99
100
101
102
103
    'astakos.im.context_processors.im_modules',
    'astakos.im.context_processors.next',
    'astakos.im.context_processors.code',
    'astakos.im.context_processors.invitations')

AUTHENTICATION_BACKENDS = ('astakos.im.auth_backends.EmailBackend',
                            'astakos.im.auth_backends.TokenBackend')

CUSTOM_USER_MODEL = 'astakos.im.AstakosUser'

Antony Chazapis's avatar
Antony Chazapis committed
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Setup logging (use this name for the setting to avoid conflicts with django > 1.2.x).
LOGGING_SETUP = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'simple': {
            'format': '%(message)s'
        },
        'verbose': {
            'format': '%(asctime)s [%(levelname)s] %(name)s %(message)s'
        },
    },
    'handlers': {
        'null': {
            'class': 'logging.NullHandler',
        },
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'verbose'
        },
root's avatar
root committed
124
125
126
127
        'file': {
            'class': 'logging.FileHandler',
            'formatter': 'verbose'
        },
Antony Chazapis's avatar
Antony Chazapis committed
128
129
130
131
132
133
134
135
    },
    'loggers': {
        'astakos': {
            'handlers': ['console'],
            'level': 'DEBUG' if DEBUG else 'INFO'
        },
    }
}
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
136
137
138
139
140

# The server is behind a proxy (apache and gunicorn setup).
USE_X_FORWARDED_HOST = False

# Set umask (needed for gunicorn setup).
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
141
142
143
#umask(0077)

# The URL where requests are redirected for login, especially when using the login_required() decorator.
root's avatar
root committed
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
LOGIN_URL = '/im'

conf = join(PROJECT_PATH, 'settings.local')
if exists(conf):
    execfile(conf)
elif exists('/etc/astakos/settings.local'):
    execfile('/etc/astakos/settings.local')

INSTALLED_APPS = (
    'astakos.im',
    'south',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.messages',
    'django.contrib.sessions'
)