· 10 years ago · Mar 20, 2016, 03:15 PM
1"""
2vim: set filetype=python:
3Django settings for alliance_auth project.
4
5For more information on this file, see
6https://docs.djangoproject.com/en/1.6/topics/settings/
7
8For the full list of settings and their values, see
9https://docs.djangoproject.com/en/1.6/ref/settings/
10
11"""
12
13# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
14import os
15
16import djcelery
17
18djcelery.setup_loader()
19BASE_DIR = os.path.dirname(os.path.dirname(__file__))
20
21# Quick-start development settings - unsuitable for production
22# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
23
24# SECURITY WARNING: keep the secret key used in production secret!
25# Generate a new key here: http://www.miniwebtool.com/django-secret-key-generator/
26SECRET_KEY = os.environ.get('AA_SECRET_KEY', 'secret key')
27
28# SECURITY WARNING: don't run with debug turned on in production!
29DEBUG = 'True' == os.environ.get('AA_DEBUG','false')
30
31TEMPLATE_DEBUG = True
32
33ALLOWED_HOSTS = ['127.0.0.1','192.168.1.205']
34
35BROKER_URL = 'amqp://guest:guest@localhost:5672/'
36
37CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
38
39# Application definition
40INSTALLED_APPS = (
41 'django.contrib.admin',
42 'django.contrib.auth',
43 'django.contrib.contenttypes',
44 'django.contrib.sessions',
45 'django.contrib.messages',
46 'django.contrib.staticfiles',
47 'django.contrib.humanize',
48 'django_evolution',
49 'djcelery',
50 'celerytask',
51 'bootstrapform',
52 'authentication',
53 'portal',
54 'registration',
55 'services',
56 'eveonline',
57 'groupmanagement',
58 'hrapplications',
59 'timerboard',
60 'srp',
61 'sigtracker',
62 'optimer',
63 'corputils',
64 'notifications',
65)
66
67MIDDLEWARE_CLASSES = (
68 'django.contrib.sessions.middleware.SessionMiddleware',
69 'django.middleware.common.CommonMiddleware',
70 'django.middleware.csrf.CsrfViewMiddleware',
71 'django.contrib.auth.middleware.AuthenticationMiddleware',
72 'django.contrib.messages.middleware.MessageMiddleware',
73 'django.middleware.clickjacking.XFrameOptionsMiddleware',
74)
75
76ROOT_URLCONF = 'alliance_auth.urls'
77
78WSGI_APPLICATION = 'alliance_auth.wsgi.application'
79
80# Database
81# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
82
83DATABASES = {
84 'default': {
85 'ENGINE': 'django.db.backends.mysql',
86 'NAME': 'alliance_auth',
87 'USER': os.environ.get('AA_DB_DEFAULT_USER', 'allianceserver2'),
88 'PASSWORD': os.environ.get('AA_DB_DEFAULT_PASSWORD', 'password'),
89 'HOST': os.environ.get('AA_DB_DEFAULT_HOST', '127.0.0.1'),
90 'PORT': os.environ.get('AA_DB_DEFAULT_PORT', '3306'),
91 },
92
93 'phpbb3': {
94 'ENGINE': 'django.db.backends.mysql',
95 'NAME': 'alliance_forum',
96 'USER': os.environ.get('AA_DB_PHPBB3_USER', 'allianceserver2'),
97 'PASSWORD': os.environ.get('AA_DB_PHPBB3_PASSWORD', 'password'),
98 'HOST': os.environ.get('AA_DB_PHPBB3_HOST', '127.0.0.1'),
99 'PORT': os.environ.get('AA_DB_PHPBB3_PORT', '3306'),
100 },
101
102 'mumble': {
103 'ENGINE': 'django.db.backends.mysql',
104 'NAME': 'alliance_mumble',
105 'USER': os.environ.get('AA_DB_MUMBLE_USER', 'allianceserver2'),
106 'PASSWORD': os.environ.get('AA_DB_MUMBLE_PASSWORD', 'password'),
107 'HOST': os.environ.get('AA_DB_MUMBLE_HOST', '127.0.0.1'),
108 'PORT': os.environ.get('AA_DB_MUMBLE_PORT', '3306'),
109 }
110}
111
112TEMPLATE_CONTEXT_PROCESSORS = (
113 'django.contrib.auth.context_processors.auth',
114 'django.core.context_processors.debug',
115 'django.core.context_processors.i18n',
116 'django.core.context_processors.media',
117 'django.core.context_processors.static',
118 'django.core.context_processors.tz',
119 'django.contrib.messages.context_processors.messages',
120 'django.core.context_processors.request',
121 'util.context_processors.is_corp',
122 'util.context_processors.corp_id',
123 'util.context_processors.corp_name',
124 'util.context_processors.alliance_id',
125 'util.context_processors.alliance_name',
126 'util.context_processors.jabber_url',
127 'util.context_processors.domain_url',
128 'util.context_processors.member_api_mask',
129 'util.context_processors.blue_api_mask',
130 'notifications.context_processors.user_notification_count',
131)
132
133TEMPLATE_DIRS = (
134 'customization/templates',
135 'stock/templates',
136 '/home/allianceserver/allianceauth/templates',
137)
138
139STATICFILES_DIRS = (
140 'customization/static',
141 'stock/static',
142 '/home/allianceserver/allianceauth/static',
143 '/home/allianceserver/allianceauth/static',
144)
145
146LOGIN_URL = '/login_user/'
147
148# Internationalization
149# https://docs.djangoproject.com/en/1.6/topics/i18n/
150
151LANGUAGE_CODE = os.environ.get('AA_LANGUAGE_CODE', 'en-us')
152
153TIME_ZONE = os.environ.get('AA_TIME_ZONE', 'UTC')
154
155USE_I18N = True
156
157USE_L10N = True
158
159USE_TZ = True
160
161# Static files (CSS, JavaScript, Images)
162# https://docs.djangoproject.com/en/1.6/howto/static-files/
163STATIC_URL = '/static/'
164STATIC_ROOT = '/home/allianceserver/allianceauth/static/'
165
166# Cache directory for EveWho, no ending /
167# by default this becomes ~/<installdir>/alliance_auth/cache
168# This directory needs to be writable by the webserver
169EVEWHO_CACHE_DIR = '{}/cache'.format(BASE_DIR)
170
171
172#####################################################
173##
174## Auth configuration starts here
175##
176#####################################################
177
178###########################
179# ALLIANCE / CORP TOGGLE
180###########################
181# Specifies to run membership checks against corp or alliance
182# Set to FALSE for alliance
183# Set to TRUE for corp
184###########################
185IS_CORP = 'True' == os.environ.get('AA_IS_CORP', 'True')
186
187
188#################
189# EMAIL SETTINGS
190#################
191# EMAIL SETTINGS
192#################
193# DOMAIN - The alliance auth domain_url
194# EMAIL_HOST - SMTP Server URL
195# EMAIL_PORT - SMTP Server PORT
196# EMAIL_HOST_USER - Email Username (for gmail, the part before @gmail.com)
197# EMAIL_HOST_PASSWORD - Email Password
198# EMAIL_USE_TLS - Set to use TLS encryption
199#################
200DOMAIN = os.environ.get('AA_DOMAIN', '192.168.1.205')
201EMAIL_HOST = os.environ.get('AA_EMAIL_HOST', 'smtp.gmail.com')
202EMAIL_PORT = int(os.environ.get('AA_EMAIL_PORT', '587'))
203EMAIL_HOST_USER = os.environ.get('AA_EMAIL_HOST_USER', 'myemail!')
204EMAIL_HOST_PASSWORD = os.environ.get('AA_EMAIL_HOST_PASSWORD', 'password')
205EMAIL_USE_TLS = 'True' == os.environ.get('AA_EMAIL_USE_TLS', 'True')
206
207####################
208# Front Page Links
209####################
210# KILLBOARD_URL - URL for your killboard. Blank to hide link
211# MEDIA_URL - URL for your media page (youtube etc). Blank to hide link
212# FORUM_URL - URL for your forums. Blank to hide link
213####################
214KILLBOARD_URL = os.environ.get('AA_KILLBOARD_URL', '')
215EXTERNAL_MEDIA_URL = os.environ.get('AA_EXTERNAL_MEDIA_URL', '')
216FORUM_URL = os.environ.get('AA_FORUM_URL', '')
217
218#########################
219# Default Group Settings
220#########################
221# DEFAULT_AUTH_GROUP - Default group members are put in
222# DEFAULT_BLUE_GROUP - Default group for blue members
223# MEMBER_CORP_GROUPS - Assign members to a group representing their main corp
224# BLUE_CORP_GROUPS - Assign blues to a group representing their main corp
225#########################
226DEFAULT_AUTH_GROUP = os.environ.get('AA_DEFAULT_ALLIANCE_GROUP', 'Member')
227DEFAULT_BLUE_GROUP = os.environ.get('AA_DEFAULT_BLUE_GROUP', 'Blue')
228MEMBER_CORP_GROUPS = 'True' == os.environ.get('AA_MEMBER_CORP_GROUPS', 'True')
229MEMBER_ALLIANCE_GROUPS = 'True' == os.environ.get('AA_MEMBER_ALLIANCE_GROUPS', 'False')
230BLUE_CORP_GROUPS = 'True' == os.environ.get('AA_BLUE_CORP_GROUPS', 'False')
231BLUE_ALLIANCE_GROUPS = 'True' == os.environ.get('AA_BLUE_ALLIANCE_GROUPS', 'False')
232
233#########################
234# Alliance Service Setup
235#########################
236# ENABLE_AUTH_FORUM - Enable forum support in the auth for auth'd members
237# ENABLE_AUTH_JABBER - Enable jabber support in the auth for auth'd members
238# ENABLE_AUTH_MUMBLE - Enable mumble support in the auth for auth'd members
239# ENABLE_AUTH_IPBOARD - Enable IPBoard forum support in the auth for auth'd members
240# ENABLE_AUTH_DISCORD - Enable Discord support in the auth for auth'd members
241#########################
242ENABLE_AUTH_FORUM = 'True' == os.environ.get('AA_ENABLE_AUTH_FORUM', 'False')
243ENABLE_AUTH_JABBER = 'True' == os.environ.get('AA_ENABLE_AUTH_JABBER', 'False')
244ENABLE_AUTH_MUMBLE = 'True' == os.environ.get('AA_ENABLE_AUTH_MUMBLE', 'False')
245ENABLE_AUTH_IPBOARD = 'True' == os.environ.get('AA_ENABLE_AUTH_IPBOARD', 'False')
246ENABLE_AUTH_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_AUTH_TEAMSPEAK3', 'False')
247ENABLE_AUTH_DISCORD = 'True' == os.environ.get('AA_ENABLE_AUTH_DISCORD', 'False')
248
249#####################
250# Blue service Setup
251#####################
252# BLUE_STANDING - The default lowest standings setting to consider blue
253# ENABLE_BLUE_FORUM - Enable forum support in the auth for blues
254# ENABLE_BLUE_JABBER - Enable jabber support in the auth for blues
255# ENABLE_BLUE_MUMBLE - Enable mumble support in the auth for blues
256# ENABLE_BLUE_IPBOARD - Enable IPBoard forum support in the auth for blues
257# ENABLE_BLUE_DISCORD - Enable Discord support in the auth for blues
258#####################
259BLUE_STANDING = float(os.environ.get('AA_BLUE_STANDING', '5.0'))
260ENABLE_BLUE_FORUM = 'True' == os.environ.get('AA_ENABLE_BLUE_FORUM', 'False')
261ENABLE_BLUE_JABBER = 'True' == os.environ.get('AA_ENABLE_BLUE_JABBER', 'False')
262ENABLE_BLUE_MUMBLE = 'True' == os.environ.get('AA_ENABLE_BLUE_MUMBLE', 'False')
263ENABLE_BLUE_IPBOARD = 'True' == os.environ.get('AA_ENABLE_BLUE_IPBOARD', 'False')
264ENABLE_BLUE_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_BLUE_TEAMSPEAK3', 'False')
265ENABLE_BLUE_DISCORD = 'True' == os.environ.get('AA_ENABLE_BLUE_DISCORD', 'False')
266
267#########################
268# Corp Configuration
269#########################
270# If running in alliance mode, the following should be for the executor corp#
271# CORP_ID - Set this to your corp ID (get this from https://zkillboard.com/corporation/#######)
272# CORP_NAME - Set this to your Corporation Name
273# CORP_API_ID - Set this to the api id for the corp API key
274# CORP_API_VCODE - Set this to the api vcode for the corp API key
275########################
276CORP_ID = os.environ.get('AA_CORP_ID', 'CorpID')
277CORP_NAME = os.environ.get('AA_CORP_NAME', 'Corpname')
278CORP_API_ID = os.environ.get('AA_CORP_API_ID', 'CorpAPI_ID')
279CORP_API_VCODE = os.environ.get('AA_CORP_API_VCODE', 'Corp_VCODE')
280
281
282#########################
283# Alliance Configuration
284#########################
285# ALLIANCE_ID - Set this to your Alliance ID (get this from https://zkillboard.com/alliance/#######)
286# ALLIANCE_NAME - Set this to your Alliance Name
287# ALLIANCE_NAME - Set this to your Alliance Name
288########################
289ALLIANCE_ID = os.environ.get('AA_ALLIANCE_ID', 'Ally_ID')
290ALLIANCE_NAME = os.environ.get('AA_ALLIANCE_NAME', 'Ally_name')
291
292########################
293# API Configuration
294########################
295# MEMBER_API_MASK - Numeric value of minimum API mask required for members
296# MEMBER_API_ACCOUNT - Require API to be for Account and not character restricted
297# BLUE_API_MASK - Numeric value of minimum API mask required for blues
298# BLUE_API_ACCOUNT - Require API to be for Account and not character restricted
299#######################
300MEMBER_API_MASK = os.environ.get('AA_MEMBER_API_MASK', 268435455)
301MEMBER_API_ACCOUNT = 'True' == os.environ.get('AA_MEMBER_API_ACCOUNT', 'True')
302BLUE_API_MASK = os.environ.get('AA_BLUE_API_MASK', 8388608)
303BLUE_API_ACCOUNT = 'True' == os.environ.get('AA_BLUE_API_ACCOUNT', 'False')
304
305#####################
306# HR Configuration
307#####################
308# JACK_KNIFE_URL - Url for the audit page of API Jack knife
309# Should seriously replace with your own.
310#####################
311JACK_KNIFE_URL = os.environ.get('AA_JACK_KNIFE_URL', 'http://ridetheclown.com/eveapi/audit.php')
312
313#####################
314# Forum Configuration
315#####################
316# IPBOARD_ENDPOINT - Api endpoint if using ipboard
317# IPBOARD_APIKEY - Api key to interact with ipboard
318# IPBOARD_APIMODULE - Module for alliance auth *leave alone*
319#####################
320IPBOARD_ENDPOINT = os.environ.get('AA_IPBOARD_ENDPOINT', 'yourdomain.com/interface/board/index.php')
321IPBOARD_APIKEY = os.environ.get('AA_IPBOARD_APIKEY', 'somekeyhere')
322IPBOARD_APIMODULE = 'aa'
323
324######################
325# Jabber Configuration
326######################
327# JABBER_URL - Jabber address url
328# JABBER_PORT - Jabber service portal
329# JABBER_SERVER - Jabber server url
330# OPENFIRE_ADDRESS - Address of the openfire admin console including port
331# Please use http with 9090 or https with 9091
332# OPENFIRE_SECRET_KEY - Openfire REST API secret key
333# BROADCAST_USER - Broadcast user JID
334# BROADCAST_USER_PASSWORD - Broadcast user password
335# BROADCAST_USER_PASSWORD - Broadcast user password
336######################
337JABBER_URL = os.environ.get('AA_JABBER_URL', "yourdomain.com")
338JABBER_PORT = int(os.environ.get('AA_JABBER_PORT', '5223'))
339JABBER_SERVER = os.environ.get('AA_JABBER_SERVER', "yourdomain.com")
340OPENFIRE_ADDRESS = os.environ.get('AA_OPENFIRE_ADDRESS', "http://yourdomain.com:9090")
341OPENFIRE_SECRET_KEY = os.environ.get('AA_OPENFIRE_SECRET_KEY', "somekey")
342BROADCAST_USER = os.environ.get('AA_BROADCAST_USER', "broadcast@") + JABBER_URL
343BROADCAST_USER_PASSWORD = os.environ.get('AA_BROADCAST_USER_PASSWORD', "somepassword")
344BROADCAST_SERVICE_NAME = os.environ.get('AA_BROADCAST_SERVICE_NAME', "broadcast")
345
346######################################
347# Mumble Configuration
348######################################
349# MUMBLE_URL - Mumble server url
350# MUMBLE_SERVER_ID - Mumble server id
351######################################
352MUMBLE_URL = os.environ.get('AA_MUMBLE_URL', "yourdomain.com")
353MUMBLE_SERVER_ID = int(os.environ.get('AA_MUMBLE_SERVER_ID', '1'))
354
355######################################
356# Teamspeak3 Configuration
357######################################
358# TEAMSPEAK3_SERVER_IP - Teamspeak3 server ip
359# TEAMSPEAK3_SERVER_PORT - Teamspeak3 server port
360# TEAMSPEAK3_SERVERQUERY_USER - Teamspeak3 serverquery username
361# TEAMSPEAK3_SERVERQUERY_PASSWORD - Teamspeak3 serverquery password
362# TEAMSPEAK3_VIRTUAL_SERVER - Virtual server id
363# TEAMSPEAK3_AUTHED_GROUP_ID - Default authed group id
364# TEAMSPEAK3_PUBLIC_URL - teamspeak3 public url used for link creation
365######################################
366TEAMSPEAK3_SERVER_IP = os.environ.get('AA_TEAMSPEAK3_SERVER_IP', '127.0.0.1')
367TEAMSPEAK3_SERVER_PORT = int(os.environ.get('AA_TEAMSPEAK3_SERVER_PORT', '10011'))
368TEAMSPEAK3_SERVERQUERY_USER = os.environ.get('AA_TEAMSPEAK3_SERVERQUERY_USER', 'serveradmin')
369TEAMSPEAK3_SERVERQUERY_PASSWORD = os.environ.get('AA_TEAMSPEAK3_SERVERQUERY_PASSWORD', 'passwordhere')
370TEAMSPEAK3_VIRTUAL_SERVER = int(os.environ.get('AA_TEAMSPEAK3_VIRTUAL_SERVER', '1'))
371TEAMSPEAK3_PUBLIC_URL = os.environ.get('AA_TEAMSPEAK3_PUBLIC_URL', 'yourdomain.com')
372
373######################################
374# Discord Configuration
375######################################
376# DISCORD_SERVER_ID - ID of the server to manage
377# DISCORD_USER_EMAIL - email of the server management user
378# DISCORD_USER_PASSWORD - password of the server management user
379######################################
380DISCORD_SERVER_ID = os.environ.get('AA_DISCORD_SERVER_ID', '')
381DISCORD_USER_EMAIL = os.environ.get('AA_DISCORD_USER_EMAIL', '')
382DISCORD_USER_PASSWORD = os.environ.get('AA_DISCORD_USER_PASSWORD', '')
383DISCORD_USER_PASSWORD = os.environ.get('AA_DISCORD_USER_PASSWORD', '')
384
385#####################################
386# Logging Configuration
387#####################################
388# Set log_file and console level to desired state:
389# DEBUG - basically stack trace, explains every step
390# INFO - model creation, deletion, updates, etc
391# WARN - unexpected function outcomes that do not impact user
392# ERROR - unexcpeted function outcomes which prevent user from achieving desired outcome
393# EXCEPTION - something critical went wrong, unhandled
394#####################################
395# Recommended level for log_file is INFO, console is DEBUG
396# Change log level of individual apps below to narrow your debugging
397#####################################
398LOGGING = {
399 'version': 1,
400 'disable_existing_loggers': False,
401 'formatters': {
402 'verbose': {
403 'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
404 'datefmt' : "%d/%b/%Y %H:%M:%S"
405 },
406 'simple': {
407 'format': '%(levelname)s %(message)s'
408 },
409 },
410 'handlers': {
411 'log_file': {
412 'level': 'INFO', # edit this line to change logging level to file
413 'class': 'logging.handlers.RotatingFileHandler',
414 'filename': os.path.join(BASE_DIR,'log/allianceauth.log'),
415 'formatter': 'verbose',
416 'maxBytes': 1024*1024*5, # edit this line to change max log file size
417 'backupCount': 5, # edit this line to change number of log backups
418 },
419 'console': {
420 'level': 'DEBUG', # edit this line to change logging level to console
421 'class': 'logging.StreamHandler',
422 'formatter': 'verbose',
423 },
424 'notifications': { # creates notifications for users with logging_notifications permission
425 'level': 'ERROR', # edit this line to change logging level to notifications
426 'class': 'notifications.handlers.NotificationHandler',
427 'formatter': 'verbose',
428 },
429 },
430 'loggers': {
431 'authentication': {
432 'handlers': ['log_file', 'console', 'notifications'],
433 'level': 'DEBUG',
434 },
435 'celerytask': {
436 'handlers': ['log_file', 'console', 'notifications'],
437 'level': 'DEBUG',
438 },
439 'eveonline': {
440 'handlers': ['log_file', 'console', 'notifications'],
441 'level': 'DEBUG',
442 },
443 'groupmanagement': {
444 'handlers': ['log_file', 'console', 'notifications'],
445 'level': 'DEBUG',
446 },
447 'hrapplications': {
448 'handlers': ['log_file', 'console', 'notifications'],
449 'level': 'DEBUG',
450 },
451 'portal': {
452 'handlers': ['log_file', 'console', 'notifications'],
453 'level': 'DEBUG',
454 },
455 'registration': {
456 'handlers': ['log_file', 'console', 'notifications'],
457 'level': 'DEBUG',
458 },
459 'services': {
460 'handlers': ['log_file', 'console', 'notifications'],
461 'level': 'DEBUG',
462 },
463 'srp': {
464 'handlers': ['log_file', 'console', 'notifications'],
465 'level': 'DEBUG',
466 },
467 'timerboard': {
468 'handlers': ['log_file', 'console', 'notifications'],
469 'level': 'DEBUG',
470 },
471 'sigtracker': {
472 'handlers': ['log_file', 'console', 'notifications'],
473 'level': 'DEBUG',
474 },
475 'optimer': {
476 'handlers': ['log_file', 'console', 'notifications'],
477 'level': 'DEBUG',
478 },
479 'corputils': {
480 'handlers': ['log_file', 'console', 'notifications'],
481 'level': 'DEBUG',
482 },
483 'util': {
484 'handlers': ['log_file', 'console', 'notifications'],
485 'level': 'DEBUG',
486 },
487 'django': {
488 'handlers': ['log_file', 'console', 'notifications'],
489 'level': 'ERROR',
490 },
491 }
492}