settings.py 4.92 KB
Newer Older
1 2
#!/usr/bin/env python
# coding: utf-8
3
# Django settings for Nuages
christophe siraut's avatar
christophe siraut committed
4
import os
5
import socket
6
from django.conf import global_settings
christophe siraut's avatar
christophe siraut committed
7

8
DEBUG = False
9
TEMPLATE_DEBUG = DEBUG
10

11
ALLOWED_HOSTS = ['.%s' % '.'.join(socket.getfqdn().split('.')[1:])]
12

13
ADMINS = (
Christophe Siraut's avatar
Christophe Siraut committed
14
    ('Nuages', 'nuages@domainepublic.net'),
15 16
)
MANAGERS = ADMINS
chris's avatar
chris committed
17
DEFAULT_FROM_EMAIL = 'nuages@domainepublic.net'
18
LOGIN_REDIRECT_URL = '/'
19
PROJECT_DIR = '/var/lib/nuages/'
20

Christophe Siraut's avatar
Christophe Siraut committed
21 22
DATABASES = {
    'default': {
Christophe Siraut's avatar
Christophe Siraut committed
23
        'ENGINE': 'django.db.backends.sqlite3',
24
        'NAME': os.path.join(PROJECT_DIR, 'db.sqlite'),
Christophe Siraut's avatar
Christophe Siraut committed
25 26 27 28
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
Christophe Siraut's avatar
Christophe Siraut committed
29 30
    },
}
31

Christophe Siraut's avatar
Christophe Siraut committed
32 33
ACCOUNT_ACTIVATION_DAYS = 7  # Activation window

34 35 36 37 38
# 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.
christophe siraut's avatar
christophe siraut committed
39
TIME_ZONE = 'Europe/Brussels'
40 41 42 43 44

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

45
LANGUAGES = (
46 47 48 49
    ('fr', u'Français'),
    ('en', u'English'),
    ('nl', u'Nederlands'),
    ('ca', u'Català')
50 51
)

52 53 54 55 56 57
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

Christophe Siraut's avatar
Christophe Siraut committed
58 59
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
60
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'www', 'media')
61 62 63

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
Christophe Siraut's avatar
Christophe Siraut committed
64
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
Christophe Siraut's avatar
Christophe Siraut committed
65
MEDIA_URL = '/media/'
Christophe Siraut's avatar
Christophe Siraut committed
66 67 68 69 70

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
71
STATIC_ROOT = os.path.join(PROJECT_DIR, 'www', 'staticroot')
Christophe Siraut's avatar
Christophe Siraut committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
89
    #'django.contrib.staticfiles.finders.DefaultStorageFinder',
Christophe Siraut's avatar
Christophe Siraut committed
90
)
91 92

# Make this unique, and don't share it with anybody.
93
SECRET_KEY = '3qm&@6264-=st16)7_xa*ds+31e0mqqs@+*!ud7gzt$tq!b^qn'
94 95 96

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
Christophe Siraut's avatar
Christophe Siraut committed
97 98
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
99
    #'django.template.loaders.eggs.load_template_source',
100 101 102 103
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
104
    'django.middleware.locale.LocaleMiddleware',
105 106
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
107
    'django.contrib.auth.middleware.AuthenticationMiddleware',
Christophe Siraut's avatar
Christophe Siraut committed
108 109
    'django.contrib.messages.middleware.MessageMiddleware',
    #'request.middleware.RequestMiddleware',
110 111
)

112
ROOT_URLCONF = 'nuages.urls'
113 114

TEMPLATE_DIRS = (
115
    # Put strings here, like "/home/html/django_templates".
116 117 118 119
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
TEMPLATE_CONTEXT_PROCESSORS =  global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
    # Required by allauth template tags
    "django.core.context_processors.request",

    # allauth specific context processors
    "allauth.account.context_processors.account",
    "allauth.socialaccount.context_processors.socialaccount",
)

AUTHENTICATION_BACKENDS = (
    # Needed to login by username in Django admin, regardless of `allauth`
    "django.contrib.auth.backends.ModelBackend",

    # `allauth` specific authentication methods, such as login by e-mail
    "allauth.account.auth_backends.AuthenticationBackend",
)

ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
ACCOUNT_USERNAME_MIN_LENGTH = 3

141 142 143 144 145
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
Christophe Siraut's avatar
Christophe Siraut committed
146 147
    'django.contrib.messages',
    'django.contrib.staticfiles',
chris's avatar
chris committed
148
    'django.contrib.admindocs',
Christophe Siraut's avatar
Christophe Siraut committed
149
    'south',
Christophe Siraut's avatar
Christophe Siraut committed
150
    'nuages_templates',
151 152 153 154 155
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.persona',
    'datetimewidget',
156
    'meetingpoll',
157
    'django.contrib.admin',
158
)
159 160

try:
161
    from local_settings import *
162
except ImportError, e:
163
    pass