root / settings.py.dist @ 23c84263
History | View | Annotate | Download (6.7 kB)
1 |
# -*- coding: utf-8 -*- |
---|---|
2 |
|
3 |
# Django settings for synnefo project. |
4 |
import os |
5 |
|
6 |
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + '/' |
7 |
|
8 |
DEBUG = True |
9 |
TEMPLATE_DEBUG = DEBUG |
10 |
|
11 |
# A quick-n-dirty way to know if we're running unit tests |
12 |
import sys |
13 |
TEST = False |
14 |
if len(sys.argv) >= 2: |
15 |
if os.path.basename(sys.argv[0]) == 'manage.py' and \ |
16 |
(sys.argv[1] == 'test' or sys.argv[1] == 'hudson'): |
17 |
TEST = True |
18 |
|
19 |
ADMINS = ( |
20 |
# ('Your Name', 'your_email@domain.com'), |
21 |
) |
22 |
|
23 |
MANAGERS = ADMINS |
24 |
|
25 |
DATABASES = { |
26 |
'default': { |
27 |
# 'postgresql_psycopg2', 'postgresql','mysql', 'sqlite3' or 'oracle' |
28 |
'ENGINE': 'sqlite3', |
29 |
# ATTENTION: This *must* be the absolute path if using sqlite3. |
30 |
# See: http://docs.djangoproject.com/en/dev/ref/settings/#name |
31 |
'NAME': PROJECT_PATH + 'database.sqlite', |
32 |
'USER': '', # Not used with sqlite3. |
33 |
'PASSWORD': '', # Not used with sqlite3. |
34 |
# Set to empty string for localhost. Not used with sqlite3. |
35 |
'HOST': '', |
36 |
# Set to empty string for default. Not used with sqlite3. |
37 |
'PORT': '', |
38 |
} |
39 |
} |
40 |
|
41 |
if DATABASES['default']['ENGINE'].endswith('mysql'): |
42 |
DATABASES['default']['OPTIONS'] = { |
43 |
'init_command': 'SET storage_engine=INNODB', |
44 |
} |
45 |
|
46 |
SESSION_ENGINE = "django.contrib.sessions.backends.cache" |
47 |
|
48 |
# Local time zone for this installation. Choices can be found here: |
49 |
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
50 |
# although not all choices may be available on all operating systems. |
51 |
# On Unix systems, a value of None will cause Django to use the same |
52 |
# timezone as the operating system. |
53 |
# If running in a Windows environment this must be set to the same as your |
54 |
# system time zone. |
55 |
TIME_ZONE = 'UTC' # Warning: API depends on the TIME_ZONE being UTC |
56 |
|
57 |
# Language code for this installation. All choices can be found here: |
58 |
# http://www.i18nguy.com/unicode/language-identifiers.html |
59 |
LANGUAGE_CODE = 'en-us' |
60 |
|
61 |
SITE_ID = 1 |
62 |
|
63 |
# If you set this to False, Django will make some optimizations so as not |
64 |
# to load the internationalization machinery. |
65 |
USE_I18N = True |
66 |
|
67 |
# If you set this to False, Django will not format dates, numbers and |
68 |
# calendars according to the current locale |
69 |
USE_L10N = True |
70 |
|
71 |
# Absolute path to the directory that holds media. |
72 |
# Example: "/home/media/media.lawrence.com/" |
73 |
MEDIA_ROOT = '' |
74 |
|
75 |
# URL that handles the media served from MEDIA_ROOT. Make sure to use a |
76 |
# trailing slash if there is a path component (optional in other cases). |
77 |
# Examples: "http://media.lawrence.com", "http://example.com/media/" |
78 |
MEDIA_URL = '' |
79 |
|
80 |
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a |
81 |
# trailing slash. |
82 |
# Examples: "http://foo.com/media/", "/media/". |
83 |
ADMIN_MEDIA_PREFIX = '/media/' |
84 |
|
85 |
# our REST API would prefer to be explicit about trailing slashes |
86 |
APPEND_SLASH = False |
87 |
|
88 |
# Make this unique, and don't share it with anybody. |
89 |
SECRET_KEY = 'ly6)mw6a7x%n)-e#zzk4jo6f2=uqu!1o%)2-(7lo+f9yd^k^bg' |
90 |
|
91 |
# List of callables that know how to import templates from various sources. |
92 |
TEMPLATE_LOADERS = ( |
93 |
'django.template.loaders.filesystem.Loader', |
94 |
'django.template.loaders.app_directories.Loader', |
95 |
# 'django.template.loaders.eggs.Loader', |
96 |
) |
97 |
|
98 |
TEMPLATE_CONTEXT_PROCESSORS = ( |
99 |
'django.core.context_processors.request', |
100 |
'django.core.context_processors.i18n', |
101 |
'django.contrib.auth.context_processors.auth', |
102 |
) |
103 |
|
104 |
MIDDLEWARE_CLASSES = ( |
105 |
'django.contrib.sessions.middleware.SessionMiddleware', |
106 |
'django.middleware.locale.LocaleMiddleware', |
107 |
'django.middleware.common.CommonMiddleware', |
108 |
'synnefo.middleware.StripURLMiddleware', |
109 |
'django.contrib.auth.middleware.AuthenticationMiddleware', |
110 |
'django.contrib.messages.middleware.MessageMiddleware', |
111 |
) |
112 |
|
113 |
ROOT_URLCONF = 'synnefo.urls' |
114 |
|
115 |
TEMPLATE_DIRS = ( |
116 |
# Put strings here, like "/home/html/django_templates" |
117 |
# or "C:/www/django/templates". |
118 |
# Always use forward slashes, even on Windows. |
119 |
# Don't forget to use absolute paths, not relative paths. |
120 |
) |
121 |
|
122 |
INSTALLED_APPS = ( |
123 |
'django.contrib.auth', |
124 |
'django.contrib.contenttypes', |
125 |
'django.contrib.sessions', |
126 |
'django.contrib.sites', |
127 |
'django.contrib.messages', |
128 |
'django.contrib.admin', |
129 |
# 'django.contrib.admindocs', |
130 |
'synnefo.auth', |
131 |
'synnefo.api', |
132 |
'synnefo.ui', |
133 |
'synnefo.db', |
134 |
'synnefo.ganeti', |
135 |
'synnefo.logic', |
136 |
'south' |
137 |
) |
138 |
|
139 |
# The RAPI endpoint and associated credentials to use |
140 |
# for talking to the Ganeti backend. |
141 |
GANETI_MASTER_IP = "62.217.120.78" |
142 |
GANETI_CLUSTER_INFO = (GANETI_MASTER_IP, 5080, "synnefo", "ocean!") |
143 |
|
144 |
# This prefix gets used when determining the instance names |
145 |
# of Synnefo VMs at the Ganeti backend. |
146 |
BACKEND_PREFIX_ID = "snf-" |
147 |
|
148 |
LANGUAGES = ( |
149 |
('el', u'Ελληνικά'), |
150 |
('en', 'English'), |
151 |
) |
152 |
|
153 |
# needed for django. this is the class that implements the User system. |
154 |
# We use this to allow users to add stuff for themselves (about, image etc) |
155 |
#http://docs.djangoproject.com/en/dev/topics/auth/#auth-profiles |
156 |
AUTH_PROFILE_MODULE = 'synnefo.OceanUser' |
157 |
|
158 |
# API requests from the GUI time out after that many seconds. |
159 |
TIMEOUT = 10 * 1000 |
160 |
|
161 |
# The API will return HTTP Bad Request if the ?changes-since |
162 |
# parameter refers to a point in time more than POLL_LIMIT seconds ago. |
163 |
POLL_LIMIT = 3600 |
164 |
|
165 |
# Configuration for ganeti-eventd, the Ganeti notification daemon |
166 |
GANETI_EVENTD_LOG_FILE = "/var/log/synnefo/ganeti-eventd.log" |
167 |
GANETI_EVENTD_PID_FILE = "/var/run/synnefo/ganeti-eventd.pid" |
168 |
|
169 |
#Rabbit work queue end point |
170 |
RABBIT_HOST="62.217.120.67:5672" |
171 |
RABBIT_USERNAME="okeanos" |
172 |
RABBIT_PASSWORD="0k3@n0s" |
173 |
RABBIT_VHOST="/" |
174 |
|
175 |
#Queues, exchanges and bindings |
176 |
EXCHANGE_GANETI="ganeti" |
177 |
EXCHANGE_CRON="cron" |
178 |
EXCHANGE_API="api" |
179 |
EXCHANGES = (EXCHANGE_GANETI, EXCHANGE_CRON, EXCHANGE_API) |
180 |
|
181 |
QUEUE_GANETI_EVENTS="events" |
182 |
QUEUE_CRON_CREDITS="credits" |
183 |
QUEUE_EMAIL="email" |
184 |
QUEUE_DEBUG="debug" |
185 |
QUEUES = (QUEUE_GANETI_EVENTS, QUEUE_CRON_CREDITS, QUEUE_EMAIL) |
186 |
|
187 |
BINDINGS_DEBUG = ( |
188 |
#Queue #Exchange #RouteKey #Handler |
189 |
(QUEUE_DEBUG, EXCHANGE_GANETI, '#', 'dummy_proc'), |
190 |
(QUEUE_DEBUG, EXCHANGE_CRON, '#', 'dummy_proc'), |
191 |
(QUEUE_DEBUG, EXCHANGE_API, '#', 'dummy_proc'), |
192 |
) |
193 |
|
194 |
BINDINGS = ( |
195 |
#Queue #Exchange #RouteKey #Handler |
196 |
(QUEUE_GANETI_EVENTS, EXCHANGE_GANETI, 'ganeti.*', 'update_db'), |
197 |
(QUEUE_CRON_CREDITS, EXCHANGE_CRON, '*.credits.*', 'update_credits'), |
198 |
(QUEUE_EMAIL, EXCHANGE_API, '*.email.*', 'send_email'), |
199 |
(QUEUE_EMAIL, EXCHANGE_CRON, '*.email.*', 'send_email'), |
200 |
) |
201 |
|
202 |
#Logic dispatcher settings |
203 |
DISPATCHER_LOG_FILE = "/var/log/okeanos.log" |
204 |
|
205 |
# The API implementation needs to accept and return absolute references |
206 |
# to its resources. Thus, it needs to know its public URL. |
207 |
API_ROOT_URL = 'http://127.0.0.1:8000/api/' |
208 |
|