Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

305 lines
12 KiB

  1. # -*- coding: utf-8 -*-
  2. # kate: space-indent on; indent-width 4; replace-tabs on;
  3. # Django settings for mumble_django project.
  4. """
  5. * Copyright © 2009-2010, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
  6. *
  7. * Mumble-Django is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This package is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. """
  17. #################################################################
  18. #################################################################
  19. ## ##
  20. ## The slice to use for communication over ZeroC Ice. ##
  21. ## This must be set to the path to the Murmur.ice file that ##
  22. ## resides in your Murmur directory. ##
  23. ## Not used on recent Murmur versions, because the slice file ##
  24. ## can be retrieved from Murmur directly. ##
  25. SLICE = '/usr/share/slice/Murmur.ice' ##
  26. ## ##
  27. ## The include dir to pass to Ice. Set this to a path in which ##
  28. ## $SLICEDIR/Ice/SliceChecksumDict.ice exists. ##
  29. ## Not used on recent Ice versions, because the SLICEDIR can ##
  30. ## be retrieved from Ice directly. ##
  31. SLICEDIR = '/usr/share/Ice/slice' ##
  32. ## ##
  33. #################################################################
  34. ## ##
  35. ## The path inside the VirtualHost that M-D lives in: ##
  36. ## ##
  37. MUMBLE_DJANGO_URL = '/' ##
  38. #MUMBLE_DJANGO_URL = '/mumble-django/' ##
  39. ## ##
  40. ## Make sure you use a trailing slash! ##
  41. ## ##
  42. #################################################################
  43. ## ##
  44. ## Mumble-Django will try to auto-detect this value if it ##
  45. ## isn't set, which is the default. However, if this should ##
  46. ## not work as expected, set this to the path where you ##
  47. ## extracted Mumble-Django. ##
  48. ## ##
  49. ## Default: Auto Detection ##
  50. MUMBLE_DJANGO_ROOT = None ##
  51. ## Examples: ##
  52. #MUMBLE_DJANGO_ROOT = '/srv/mumble-django' ##
  53. #MUMBLE_DJANGO_ROOT = 'c:/web/mumble-django' ##
  54. ## ##
  55. #################################################################
  56. ## ##
  57. ## For a basic installation, this is all you need to edit in ##
  58. ## this file, the rest will be handled automatically! ##
  59. ## ##
  60. #################################################################
  61. #################################################################
  62. # Who will receive emails on errors?
  63. ADMINS = (
  64. # ('Your Name', 'your_email@domain.com'),
  65. )
  66. # Show debug information on errors?
  67. # If you want to file a bug report, please enable this option.
  68. DEBUG = True
  69. # These IPs will be delivered the debug templates if DEBUG == True.
  70. INTERNAL_IPS = ['127.0.0.1']
  71. # Local time zone for this installation. Choices can be found here:
  72. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  73. # although not all choices may be available on all operating systems.
  74. # If running in a Windows environment this must be set to the same as your
  75. # system time zone.
  76. TIME_ZONE = 'Europe/Berlin'
  77. # Language code for this installation. All choices can be found here:
  78. # http://www.i18nguy.com/unicode/language-identifiers.html
  79. LANGUAGE_CODE = 'en-us'
  80. # The Theme to use. None for the builtin theme.
  81. THEME = None
  82. # URL Template for constructing Gravatars.
  83. GRAVATAR_URL = 'http://www.gravatar.com/avatar/%(hash)s.jpg?d=monsterid&s=%(size)d'
  84. # Automatically set the Gravatar as the user's avatar when creating new users?
  85. USE_GRAVATAR = True
  86. # The default connection string to set for newly created instances.
  87. # Ice:
  88. DEFAULT_CONN = 'Meta:tcp -h 127.0.0.1 -p 6502'
  89. # DBus:
  90. #DEFAULT_CONN = 'net.sourceforge.mumble.murmur'
  91. # Default email address to send mails from.
  92. DEFAULT_FROM_EMAIL = "webmaster@localhost"
  93. # Length of the account activation period, in days.
  94. ACCOUNT_ACTIVATION_DAYS = 30
  95. # Should subchannels be shown, even if there are no players in them?
  96. SHOW_EMPTY_SUBCHANS = False
  97. # Protect the registration form for private servers?
  98. # If set to True, people will need to enter the server password in order to create accounts,
  99. # and will not be able to link existing accounts.
  100. PROTECTED_MODE = False
  101. # Account linking allows users who registered their accounts through Mumble instead of using
  102. # Mumble-Django, to tell MD that this account belongs to them. Then they can use MD to change
  103. # their passwords.
  104. # This will of course require them to enter the password that belongs to the Murmur account,
  105. # and the accounts will only be linked if the password is correct.
  106. # By default, this is enabled only for non-admin accounts, because if an admin account gets
  107. # stolen they could easily take over the server. (So make sure the password can't be easily
  108. # guessed, use at least over 9000 letters, blah blah.)
  109. # This feature is only available if PROTECTED_MODE is not active.
  110. ALLOW_ACCOUNT_LINKING = True # Allow linking in general?
  111. ALLOW_ACCOUNT_LINKING_ADMINS = False # Allow linking for Admin accounts?
  112. # Warning and Critical levels for the Munin plugin. These will be multiplied with the
  113. # server instance's slot count to calculate the real levels.
  114. MUNIN_WARNING = 0.80
  115. MUNIN_CRITICAL = 0.95
  116. # The graph title.
  117. MUNIN_TITLE = 'Mumble Users'
  118. # see <http://munin.projects.linpro.no/wiki/graph_category_list> for a list of valid categories.
  119. MUNIN_CATEGORY = 'mumble'
  120. # Set to True if you do not wish offline servers to appear in the server list.
  121. HIDE_OFFLINE_SERVERS=False
  122. # True to display users above channels in the channel viewer.
  123. USERS_ABOVE_CHANNELS=False
  124. ###################################################################
  125. ## ##
  126. ## The following settings normally do not require changes, and ##
  127. ## you should only change them if you know what you're doing. ##
  128. ## ##
  129. ###################################################################
  130. from os.path import join, dirname, abspath, exists
  131. if not MUMBLE_DJANGO_ROOT or not exists( MUMBLE_DJANGO_ROOT ):
  132. MUMBLE_DJANGO_ROOT = dirname(dirname(abspath(__file__)))
  133. # Default mumble port. If your server runs under this port, it will not be
  134. # included in the links in the Channel Viewer.
  135. MUMBLE_DEFAULT_PORT = 64738
  136. if not MUMBLE_DJANGO_URL:
  137. MUMBLE_DJANGO_URL = '/'
  138. elif MUMBLE_DJANGO_URL[-1] != '/':
  139. MUMBLE_DJANGO_URL = MUMBLE_DJANGO_URL + '/'
  140. # Database settings for Mumble-Django's database. These do NOT need to point
  141. # to Murmur's database, Mumble-Django should use its own!
  142. DATABASES = {
  143. 'default': {
  144. 'ENGINE': 'django.db.backends.sqlite3',
  145. 'NAME': join( MUMBLE_DJANGO_ROOT, 'db', 'mumble-django.db3' ),
  146. 'USER': '',
  147. 'PASSWORD': '',
  148. 'HOST': '',
  149. 'PORT': '',
  150. }
  151. }
  152. # Email settings. only change if the defaults don't work
  153. #EMAIL_HOST = "localhost"
  154. #EMAIL_PORT = 25
  155. #EMAIL_HOST_USER = ""
  156. #EMAIL_HOST_PASSWORD = ""
  157. #EMAIL_USE_TLS = True
  158. TEMPLATE_DEBUG = DEBUG
  159. MANAGERS = ADMINS
  160. SITE_ID = 1
  161. # If you set this to False, Django will make some optimizations so as not
  162. # to load the internationalization machinery.
  163. USE_I18N = True
  164. USE_L10N = True
  165. STATIC_URL = MUMBLE_DJANGO_URL + 'static/'
  166. STATICFILES_DIRS = (
  167. join( MUMBLE_DJANGO_ROOT, 'htdocs' ),
  168. )
  169. ## URL to static files of the currently active theme
  170. THEME_URL = '%sstatic/themes/%s/' % ( MUMBLE_DJANGO_URL, THEME )
  171. # URL to the login view
  172. LOGIN_URL = MUMBLE_DJANGO_URL + 'accounts/login/'
  173. LOGIN_REDIRECT_URL = MUMBLE_DJANGO_URL + 'accounts/profile/'
  174. # Automatically generate a .secret.txt file containing the SECRET_KEY.
  175. # Shamelessly stolen from ByteFlow: <http://www.byteflow.su>
  176. try:
  177. SECRET_KEY
  178. except NameError:
  179. SECRET_FILE = join(MUMBLE_DJANGO_ROOT, '.secret.txt')
  180. try:
  181. SECRET_KEY = open(SECRET_FILE).read().strip()
  182. except IOError:
  183. try:
  184. from random import choice
  185. SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
  186. secret = file(SECRET_FILE, 'w')
  187. secret.write(SECRET_KEY)
  188. secret.close()
  189. except IOError:
  190. Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)
  191. # List of callables that know how to import templates from various sources.
  192. TEMPLATE_LOADERS = (
  193. 'django.template.loaders.filesystem.Loader',
  194. 'django.template.loaders.app_directories.Loader',
  195. # 'django.template.loaders.eggs.Loader',
  196. )
  197. MIDDLEWARE_CLASSES = (
  198. 'django.middleware.common.CommonMiddleware',
  199. 'django.contrib.sessions.middleware.SessionMiddleware',
  200. 'django.middleware.csrf.CsrfViewMiddleware',
  201. 'django.middleware.locale.LocaleMiddleware',
  202. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  203. 'django.contrib.messages.middleware.MessageMiddleware'
  204. )
  205. ROOT_URLCONF = 'urls'
  206. if THEME:
  207. TEMPLATE_DIRS = [ join( MUMBLE_DJANGO_ROOT, 'themes', THEME ) ]
  208. else:
  209. TEMPLATE_DIRS = []
  210. TEMPLATE_DIRS.extend((
  211. # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  212. # Always use forward slashes, even on Windows.
  213. # Don't forget to use absolute paths, not relative paths.
  214. join( MUMBLE_DJANGO_ROOT, 'pyweb', 'templates' ),
  215. ))
  216. TEMPLATE_CONTEXT_PROCESSORS = [
  217. "django.contrib.auth.context_processors.auth",
  218. "django.core.context_processors.debug",
  219. "django.core.context_processors.i18n",
  220. "django.core.context_processors.media",
  221. 'processors.installed_apps',
  222. 'processors.mumble_version',
  223. 'processors.mumble_media_prefix',
  224. ]
  225. if THEME:
  226. TEMPLATE_CONTEXT_PROCESSORS.append('processors.theme_url')
  227. #TEST_RUNNER = 'mumble.testrunner.run_tests'
  228. #TEST_MURMUR_LAB_DIR = join( dirname(MUMBLE_DJANGO_ROOT), 'murmur' )
  229. #TEST_MURMUR_FILES_DIR = join( MUMBLE_DJANGO_ROOT, 'testdata' )
  230. CONVERSIONSQL_ROOT = join( MUMBLE_DJANGO_ROOT, "pyweb", "mumble", "conversionsql" )
  231. INSTALLED_APPS = [
  232. 'django.contrib.auth',
  233. 'django.contrib.admin',
  234. 'django.contrib.admindocs',
  235. 'django.contrib.contenttypes',
  236. 'django.contrib.messages',
  237. 'django.contrib.staticfiles',
  238. 'django.contrib.sessions',
  239. 'django.contrib.sites',
  240. 'mumble',
  241. ]
  242. def modprobe( name ):
  243. """ Try to import the named module, and if that works add it to INSTALLED_APPS. """
  244. try:
  245. __import__( name )
  246. except ImportError:
  247. pass
  248. else:
  249. INSTALLED_APPS.append( name )
  250. # Check if rosetta is available.
  251. # http://code.google.com/p/django-rosetta
  252. modprobe( "rosetta" )
  253. # Check if django_extensions is available.
  254. modprobe( "django_extensions" )
  255. modprobe( 'registration' )