mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
Temporarily use latest snapshot for esi for dj20 Correct admin urls include Manually correct old ts3 table migration Remove obsolete services migrations Remove bootstrap pagination package Fix url namespacing
566 lines
18 KiB
Python
566 lines
18 KiB
Python
# -*- coding: UTF-8 -*-
|
|
"""
|
|
Django settings for alliance_auth project.
|
|
|
|
Generated by 'django-admin startproject' using Django 1.10.1.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/1.10/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/1.10/ref/settings/
|
|
"""
|
|
|
|
import os
|
|
|
|
from django.contrib import messages
|
|
from celery.schedules import crontab
|
|
|
|
INSTALLED_APPS = [
|
|
# Core apps - required to function
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.humanize',
|
|
'django_celery_beat',
|
|
'bootstrapform',
|
|
'sortedm2m',
|
|
'esi',
|
|
'allianceauth',
|
|
'allianceauth.authentication',
|
|
'allianceauth.services',
|
|
'allianceauth.eveonline',
|
|
'allianceauth.groupmanagement',
|
|
'allianceauth.notifications',
|
|
'allianceauth.thirdparty.navhelper',
|
|
|
|
|
|
# Optional apps - remove if not desired
|
|
'allianceauth.corputils',
|
|
'allianceauth.hrapplications',
|
|
'allianceauth.timerboard',
|
|
'allianceauth.srp',
|
|
'allianceauth.optimer',
|
|
'allianceauth.fleetup',
|
|
'allianceauth.fleetactivitytracking',
|
|
'allianceauth.permissions_tool',
|
|
|
|
# Services - remove if not used
|
|
'allianceauth.services.modules.mumble',
|
|
'allianceauth.services.modules.discord',
|
|
'allianceauth.services.modules.discourse',
|
|
'allianceauth.services.modules.ips4',
|
|
'allianceauth.services.modules.market',
|
|
'allianceauth.services.modules.openfire',
|
|
'allianceauth.services.modules.seat',
|
|
'allianceauth.services.modules.smf',
|
|
'allianceauth.services.modules.phpbb3',
|
|
'allianceauth.services.modules.xenforo',
|
|
'allianceauth.services.modules.teamspeak3',
|
|
]
|
|
|
|
#####################################################
|
|
##
|
|
## Django Project Configuration
|
|
##
|
|
#####################################################
|
|
# Don't touch unless you know what you're doing.
|
|
# Scroll down for Auth Configuration
|
|
#####################################################
|
|
|
|
# Celery configuration
|
|
BROKER_URL = 'redis://localhost:6379/0'
|
|
CELERYBEAT_SCHEDULER = "django_celery_beat.schedulers.DatabaseScheduler"
|
|
CELERYBEAT_SCHEDULE = {
|
|
'esi_cleanup_callbackredirect': {
|
|
'task': 'esi.tasks.cleanup_callbackredirect',
|
|
'schedule': crontab(hour='*/4'),
|
|
},
|
|
'esi_cleanup_token': {
|
|
'task': 'esi.tasks.cleanup_token',
|
|
'schedule': crontab(day_of_month='*/1'),
|
|
},
|
|
'run_model_update': {
|
|
'task': 'allianceauth.eveonline.tasks.run_model_update',
|
|
'schedule': crontab(minute=0, hour="*/6"),
|
|
},
|
|
'check_all_character_ownership': {
|
|
'task': 'allianceauth.authentication.tasks.check_all_character_ownership',
|
|
'schedule': crontab(hour='*/4'),
|
|
}
|
|
}
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
'django.middleware.locale.LocaleMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'allianceauth.urls'
|
|
|
|
LOCALE_PATHS = (
|
|
os.path.join(BASE_DIR, 'locale/'),
|
|
)
|
|
|
|
ugettext = lambda s: s
|
|
LANGUAGES = (
|
|
('en', ugettext('English')),
|
|
('de', ugettext('German')),
|
|
)
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.request',
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.contrib.messages.context_processors.messages',
|
|
'django.template.context_processors.i18n',
|
|
'django.template.context_processors.media',
|
|
'django.template.context_processors.static',
|
|
'django.template.context_processors.tz',
|
|
'allianceauth.context_processors.auth_settings',
|
|
'allianceauth.notifications.context_processors.user_notification_count',
|
|
'allianceauth.groupmanagement.context_processors.can_manage_groups',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'alliance_auth.wsgi.application'
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
|
},
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
},
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
},
|
|
{
|
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
},
|
|
]
|
|
|
|
AUTHENTICATION_BACKENDS = ['allianceauth.authentication.backends.StateBackend', 'django.contrib.auth.backends.ModelBackend']
|
|
LOGIN_URL = 'auth_login_user'
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/1.10/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
|
|
|
# Bootstrap messaging css workaround
|
|
MESSAGE_TAGS = {
|
|
messages.ERROR: 'danger'
|
|
}
|
|
|
|
CACHES = {
|
|
"default": {
|
|
"BACKEND": "redis_cache.RedisCache",
|
|
"LOCATION": "localhost:6379",
|
|
"OPTIONS": {
|
|
"DB": 1,
|
|
}
|
|
}
|
|
}
|
|
|
|
#####################################################
|
|
##
|
|
## Auth Configuration
|
|
##
|
|
#####################################################
|
|
|
|
###############################
|
|
# Required Django Settings
|
|
###############################
|
|
# SECRET_KEY - Random alphanumeric string for cryptographic signing
|
|
# http://www.miniwebtool.com/django-secret-key-generator/
|
|
# DEBUG - True to display stack traces when errors are encountered.
|
|
# Set this False once auth is installed and working for security.
|
|
# ALLOWED_HOSTS - A list of hosts to serve content on. Wildcards accepted.
|
|
# Requests for hosts not listed here will be rejected.
|
|
# Example: ['example.com', 'auth.example.com']
|
|
# DATABASES - Auth database connection information.
|
|
################################
|
|
SECRET_KEY = ''
|
|
DEBUG = True
|
|
ALLOWED_HOSTS = []
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'alliance_auth',
|
|
'USER': 'allianceserver',
|
|
'PASSWORD': '',
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '3306',
|
|
},
|
|
}
|
|
|
|
####################################
|
|
# SITE_NAME - Name of the auth site.
|
|
####################################
|
|
SITE_NAME = 'Alliance Auth'
|
|
|
|
#################
|
|
# EMAIL SETTINGS
|
|
#################
|
|
# DEFAULT_FROM_EMAIL - no-reply email address
|
|
# DOMAIN - The Alliance Auth domain (or subdomain) address, no leading http://
|
|
# EMAIL_HOST - SMTP Server URL
|
|
# EMAIL_PORT - SMTP Server PORT
|
|
# EMAIL_HOST_USER - Email Username (for gmail, the entire address)
|
|
# EMAIL_HOST_PASSWORD - Email Password
|
|
# EMAIL_USE_TLS - Set to use TLS encryption
|
|
#################
|
|
DEFAULT_FROM_EMAIL = 'no-reply@example.com'
|
|
DOMAIN = 'example.com'
|
|
EMAIL_HOST = 'smtp.gmail.com'
|
|
EMAIL_PORT = 587
|
|
EMAIL_HOST_USER = ''
|
|
EMAIL_HOST_PASSWORD = ''
|
|
EMAIL_USE_TLS = True
|
|
|
|
###################
|
|
# SSO Settings
|
|
###################
|
|
# Get client ID and client secret from registering an app at
|
|
# https://developers.eveonline.com/
|
|
# Callback URL should be https://example.com/sso/callback
|
|
###################
|
|
ESI_SSO_CLIENT_ID = ''
|
|
ESI_SSO_CLIENT_SECRET = ''
|
|
ESI_SSO_CALLBACK_URL = ''
|
|
|
|
#################
|
|
# Login Settings
|
|
#################
|
|
# LOGIN_REDIRECT_URL - default destination when logging in if no redirect specified
|
|
# LOGOUT_REDIRECT_URL - destination after logging out
|
|
# Both of these redirects accept values as per the django redirect shortcut
|
|
# https://docs.djangoproject.com/en/1.10/topics/http/shortcuts/#redirect
|
|
# - url names eg 'authentication:dashboard'
|
|
# - relative urls eg '/dashboard'
|
|
# - absolute urls eg 'http://example.com/dashboard'
|
|
# LOGIN_TOKEN_SCOPES - scopes required on new tokens when logging in. Cannot be blank.
|
|
# ACCOUNT_ACTIVATION_DAYS - number of days email verification tokens are valid for
|
|
##################
|
|
LOGIN_REDIRECT_URL = 'authentication:dashboard'
|
|
LOGOUT_REDIRECT_URL = 'authentication:dashboard'
|
|
LOGIN_TOKEN_SCOPES = ['esi-characters.read_opportunities.v1']
|
|
ACCOUNT_ACTIVATION_DAYS = 1
|
|
|
|
#####################################################
|
|
##
|
|
## Service Configuration
|
|
##
|
|
#####################################################
|
|
|
|
#####################
|
|
# Alliance Market
|
|
#####################
|
|
MARKET_URL = 'http://example.com/market'
|
|
MARKET_DB = {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'alliance_market',
|
|
'USER': 'allianceserver-market',
|
|
'PASSWORD': '',
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '3306',
|
|
}
|
|
|
|
########################
|
|
# XenForo Configuration
|
|
########################
|
|
XENFORO_ENDPOINT = 'example.com/api.php'
|
|
XENFORO_DEFAULT_GROUP = 0
|
|
XENFORO_APIKEY = ''
|
|
#####################
|
|
|
|
######################
|
|
# Jabber Configuration
|
|
######################
|
|
# JABBER_URL - Jabber address url, no leading http://
|
|
# JABBER_PORT - Jabber service portal
|
|
# JABBER_SERVER - Jabber server url (server name, eg 'example.com'), no leading http://
|
|
# OPENFIRE_ADDRESS - Address of the openfire admin console including port
|
|
# Please use http:// with 9090 or https:// with 9091
|
|
# eg 'http://example.com:9090' or 'https://example.com:9091'
|
|
# OPENFIRE_SECRET_KEY - Openfire REST API secret key
|
|
# BROADCAST_USER - Broadcast user username (before @ sign)
|
|
# BROADCAST_USER_PASSWORD - Broadcast user password
|
|
# BROADCAST_SERVICE_NAME - Name of the Openfire service to broadcast to, usually "broadcast"
|
|
######################
|
|
JABBER_URL = ''
|
|
JABBER_PORT = 5223
|
|
JABBER_SERVER = ''
|
|
OPENFIRE_ADDRESS = ''
|
|
OPENFIRE_SECRET_KEY = ''
|
|
BROADCAST_USER = "broadcast" + "@" + JABBER_URL
|
|
BROADCAST_USER_PASSWORD = ''
|
|
BROADCAST_SERVICE_NAME = "broadcast"
|
|
|
|
######################################
|
|
# Mumble Configuration
|
|
######################################
|
|
# MUMBLE_URL - Mumble server url, tolerates leading http://, mumble://, or none
|
|
# eg 'http://example.com', 'mumble://example.com', or 'example.com'
|
|
######################################
|
|
MUMBLE_URL = ''
|
|
|
|
######################################
|
|
# PHPBB3 Configuration
|
|
######################################
|
|
PHPBB3_URL = 'http://example.com/phpbb/'
|
|
PHPBB3_DB = {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'alliance_forum',
|
|
'USER': 'allianceserver-phpbb3',
|
|
'PASSWORD': '',
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '3306',
|
|
}
|
|
|
|
######################################
|
|
# Teamspeak3 Configuration
|
|
######################################
|
|
# TEAMSPEAK3_SERVER_IP - Teamspeak3 server ip
|
|
# TEAMSPEAK3_SERVER_PORT - Teamspeak3 server port
|
|
# TEAMSPEAK3_SERVERQUERY_USER - Teamspeak3 serverquery username
|
|
# TEAMSPEAK3_SERVERQUERY_PASSWORD - Teamspeak3 serverquery password
|
|
# TEAMSPEAK3_VIRTUAL_SERVER - Virtual server id
|
|
# TEAMSPEAK3_AUTHED_GROUP_ID - Default authed group id
|
|
# TEAMSPEAK3_PUBLIC_URL - teamspeak3 public url used for link creation
|
|
######################################
|
|
TEAMSPEAK3_SERVER_IP = '127.0.0.1'
|
|
TEAMSPEAK3_SERVER_PORT = 10011
|
|
TEAMSPEAK3_SERVERQUERY_USER = 'serveradmin'
|
|
TEAMSPEAK3_SERVERQUERY_PASSWORD = ''
|
|
TEAMSPEAK3_VIRTUAL_SERVER = 1
|
|
TEAMSPEAK3_PUBLIC_URL = ''
|
|
|
|
######################################
|
|
# Discord Configuration
|
|
######################################
|
|
# DISCORD_GUILD_ID - ID of the guild to manage
|
|
# DISCORD_BOT_TOKEN - OAuth token of the app bot user
|
|
# DISCORD_INVITE_CODE - Alphanumeric string invite code to the server
|
|
# Do not include the leading http://discord.gg/
|
|
# DISCORD_APP_ID - OAuth app client ID
|
|
# DISCORD_APP_SECRET - OAuth app secret
|
|
# DISCORD_CALLBACK_URL - OAuth callback url
|
|
# Should be of the form 'http://example.com/discord/callback'
|
|
# DISCORD_SYNC_NAMES - Force discord nicknames to be set to eve char name
|
|
######################################
|
|
DISCORD_GUILD_ID = ''
|
|
DISCORD_BOT_TOKEN = ''
|
|
DISCORD_INVITE_CODE = ''
|
|
DISCORD_APP_ID = ''
|
|
DISCORD_APP_SECRET = ''
|
|
DISCORD_CALLBACK_URL = ''
|
|
DISCORD_SYNC_NAMES = False
|
|
|
|
######################################
|
|
# Discourse Configuration
|
|
######################################
|
|
# DISCOURSE_URL - Web address of the forums (no trailing slash). Include http://
|
|
# DISCOURSE_API_USERNAME - API account username
|
|
# DISCOURSE_API_KEY - API Key
|
|
# DISCOURSE_SSO_SECRET - SSO secret key
|
|
######################################
|
|
DISCOURSE_URL = ''
|
|
DISCOURSE_API_USERNAME = ''
|
|
DISCOURSE_API_KEY = ''
|
|
DISCOURSE_SSO_SECRET = ''
|
|
|
|
#####################################
|
|
# IPS4 Configuration
|
|
#####################################
|
|
# IPS4_URL - Base URL of the IPS4 install (no trailing slash). Include http://
|
|
#####################################
|
|
IPS4_URL = ''
|
|
IPS4_DB = {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'alliance_ips4',
|
|
'USER': 'allianceserver-ips4',
|
|
'PASSWORD': '',
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '3306',
|
|
}
|
|
|
|
#####################################
|
|
# SEAT Configuration
|
|
#####################################
|
|
# SEAT_URL - Base URL of the seat install (no trailing slash). Include http://
|
|
# SEAT_XTOKEN - API key X-Token provided by SeAT
|
|
#####################################
|
|
SEAT_URL = ''
|
|
SEAT_XTOKEN = ''
|
|
|
|
######################################
|
|
# SMF Configuration
|
|
######################################
|
|
# SMF_URL - Web address of the forums. Include leading http://
|
|
######################################
|
|
SMF_URL = ''
|
|
SMF_DB = {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'alliance_smf',
|
|
'USER': 'allianceserver-smf',
|
|
'PASSWORD': '',
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '3306',
|
|
}
|
|
|
|
######################################
|
|
# Fleet-Up Configuration
|
|
######################################
|
|
# FLEETUP_APP_KEY - The app key from http://fleet-up.com/Api/MyApps
|
|
# FLEETUP_USER_ID - The user id from http://fleet-up.com/Api/MyKeys
|
|
# FLEETUP_API_ID - The API id from http://fleet-up.com/Api/MyKeys
|
|
# FLEETUP_GROUP_ID - The id of the group you want to pull data from, see http://fleet-up.com/Api/Endpoints#groups_mygroupmemberships
|
|
######################################
|
|
FLEETUP_APP_KEY = os.environ.get('AA_FLEETUP_APP_KEY', '')
|
|
FLEETUP_USER_ID = os.environ.get('AA_FLEETUP_USER_ID', '')
|
|
FLEETUP_API_ID = os.environ.get('AA_FLEETUP_API_ID', '')
|
|
FLEETUP_GROUP_ID = os.environ.get('AA_FLEETUP_GROUP_ID', '')
|
|
|
|
#####################################################
|
|
##
|
|
## Logging Configuration
|
|
##
|
|
#####################################################
|
|
# Set log_file and console level to desired state:
|
|
# DEBUG - basically stack trace, explains every step
|
|
# INFO - model creation, deletion, updates, etc
|
|
# WARN - unexpected function outcomes that do not impact user
|
|
# ERROR - unexcpeted function outcomes which prevent user from achieving desired outcome
|
|
# EXCEPTION - something critical went wrong, unhandled
|
|
#####################################
|
|
# Recommended level for log_file is INFO, console is DEBUG
|
|
# Change log level of individual apps below to narrow your debugging
|
|
#####################################
|
|
LOGGING = {
|
|
'version': 1,
|
|
'disable_existing_loggers': False,
|
|
'formatters': {
|
|
'verbose': {
|
|
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
|
|
'datefmt' : "%d/%b/%Y %H:%M:%S"
|
|
},
|
|
'simple': {
|
|
'format': '%(levelname)s %(message)s'
|
|
},
|
|
},
|
|
'handlers': {
|
|
'log_file': {
|
|
'level': 'INFO', # edit this line to change logging level to file
|
|
'class': 'logging.handlers.RotatingFileHandler',
|
|
'filename': os.path.join(BASE_DIR,'log/allianceauth.log'),
|
|
'formatter': 'verbose',
|
|
'maxBytes': 1024*1024*5, # edit this line to change max log file size
|
|
'backupCount': 5, # edit this line to change number of log backups
|
|
},
|
|
'console': {
|
|
'level': 'DEBUG', # edit this line to change logging level to console
|
|
'class': 'logging.StreamHandler',
|
|
'formatter': 'verbose',
|
|
},
|
|
'notifications': { # creates notifications for users with logging_notifications permission
|
|
'level': 'ERROR', # edit this line to change logging level to notifications
|
|
'class': 'allianceauth.notifications.handlers.NotificationHandler',
|
|
'formatter': 'verbose',
|
|
},
|
|
},
|
|
'loggers': {
|
|
'allianceauth': {
|
|
'handlers': ['log_file', 'console', 'notifications'],
|
|
'level': 'DEBUG',
|
|
},
|
|
'celerytask': {
|
|
'handlers': ['log_file', 'console', 'notifications'],
|
|
'level': 'DEBUG',
|
|
},
|
|
'portal': {
|
|
'handlers': ['log_file', 'console', 'notifications'],
|
|
'level': 'DEBUG',
|
|
},
|
|
'registration': {
|
|
'handlers': ['log_file', 'console', 'notifications'],
|
|
'level': 'DEBUG',
|
|
},
|
|
'util': {
|
|
'handlers': ['log_file', 'console', 'notifications'],
|
|
'level': 'DEBUG',
|
|
},
|
|
'django': {
|
|
'handlers': ['log_file', 'console'],
|
|
'level': 'ERROR',
|
|
},
|
|
}
|
|
}
|
|
|
|
#####################################################
|
|
##
|
|
## Magic Block
|
|
##
|
|
#####################################################
|
|
# This block automagically inserts needed settings if
|
|
# certain services are installed.
|
|
# Don't touch.
|
|
#########################################
|
|
|
|
# Conditionally add databases only if configured
|
|
if 'services.modules.phpbb3' in INSTALLED_APPS:
|
|
DATABASES['phpbb3'] = PHPBB3_DB
|
|
if 'services.modules.smf' in INSTALLED_APPS:
|
|
DATABASES['smf'] = SMF_DB
|
|
if 'services.modules.market' in INSTALLED_APPS:
|
|
DATABASES['market'] = MARKET_DB
|
|
if 'services.modules.ips4' in INSTALLED_APPS:
|
|
DATABASES['ips4'] = IPS4_DB
|
|
|
|
|
|
# Conditionally add periodic tasks for services if installed
|
|
if 'services.modules.teamspeak3' in INSTALLED_APPS:
|
|
CELERYBEAT_SCHEDULE['run_ts3_group_update'] = {
|
|
'task': 'services.modules.teamspeak3.tasks.run_ts3_group_update',
|
|
'schedule': crontab(minute='*/30'),
|
|
}
|