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.

236 lines
9.0 KiB

  1. # -*- coding: utf-8 -*-
  2. # Django settings for mumble_django project.
  3. """
  4. * Copyright © 2009-2010, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
  5. *
  6. * Mumble-Django is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This package is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. """
  16. #################################################################
  17. #################################################################
  18. ## ##
  19. ## The slice to use for communication over ZeroC Ice. ##
  20. ## This must be set to the path to the Murmur.ice file that ##
  21. ## resides in your Murmur directory. ##
  22. SLICE = '/usr/share/slice/Murmur.ice' ##
  23. ## ##
  24. #################################################################
  25. ## ##
  26. ## The path inside the VirtualHost that M-D lives in: ##
  27. ## ##
  28. MUMBLE_DJANGO_URL = '/' ##
  29. #MUMBLE_DJANGO_URL = '/mumble-django/' ##
  30. ## ##
  31. ## Make sure you use a trailing slash! ##
  32. ## ##
  33. #################################################################
  34. ## ##
  35. ## Mumble-Django will try to auto-detect this value if it ##
  36. ## isn't set, which is the default. However, if this should ##
  37. ## not work as expected, set this to the path where you ##
  38. ## extracted Mumble-Django. ##
  39. ## ##
  40. ## Default: Auto Detection ##
  41. MUMBLE_DJANGO_ROOT = None ##
  42. ## Examples: ##
  43. #MUMBLE_DJANGO_ROOT = '/srv/mumble-django' ##
  44. #MUMBLE_DJANGO_ROOT = 'c:/web/mumble-django' ##
  45. ## ##
  46. #################################################################
  47. ## ##
  48. ## For a basic installation, this is all you need to edit in ##
  49. ## this file, the rest will be handled automatically! ##
  50. ## ##
  51. #################################################################
  52. #################################################################
  53. from os.path import join, dirname, abspath, exists
  54. if not MUMBLE_DJANGO_ROOT or not exists( MUMBLE_DJANGO_ROOT ):
  55. MUMBLE_DJANGO_ROOT = dirname(dirname(abspath(__file__)));
  56. # The default connection string to set for newly created instances.
  57. # ICE:
  58. DEFAULT_CONN = 'Meta:tcp -h 127.0.0.1 -p 6502'
  59. # DBus:
  60. #DEFAULT_CONN = 'net.sourceforge.mumble.murmur'
  61. # Default email address to send mails from.
  62. DEFAULT_FROM_EMAIL = "webmaster@localhost"
  63. # Length of the account activation period, in days.
  64. ACCOUNT_ACTIVATION_DAYS = 30
  65. # Default mumble port. If your server runs under this port, it will not be included in the links in the Channel Viewer.
  66. MUMBLE_DEFAULT_PORT = 64738
  67. # Should subchannels be shown, even if there are no players in them?
  68. SHOW_EMPTY_SUBCHANS = False
  69. # Protect the registration form for private servers?
  70. # If set to True, people will need to enter the server password in order to create accounts,
  71. # and will not be able to link existing accounts.
  72. PROTECTED_MODE = False
  73. # Account linking allows users who registered their accounts through Mumble instead of using
  74. # Mumble-Django, to tell MD that this account belongs to them. Then they can use MD to change
  75. # their passwords.
  76. # This will of course require them to enter the password that belongs to the Murmur account,
  77. # and the accounts will only be linked if the password is correct.
  78. # By default, this is enabled only for non-admin accounts, because if an admin account gets
  79. # stolen they could easily take over the server. (So make sure the password can't be easily
  80. # guessed, use at least over 9000 letters, blah blah.)
  81. # This feature is only available if PROTECTED_MODE is not active.
  82. ALLOW_ACCOUNT_LINKING = True # Allow linking in general?
  83. ALLOW_ACCOUNT_LINKING_ADMINS = False # Allow linking for Admin accounts?
  84. # Warning and Critical levels for the Munin plugin. These will be multiplied with the
  85. # server instance's slot count to calculate the real levels.
  86. MUNIN_WARNING = 0.80
  87. MUNIN_CRITICAL = 0.95
  88. # The graph title.
  89. MUNIN_TITLE = 'Mumble Users'
  90. # see <http://munin.projects.linpro.no/wiki/graph_category_list> for a list of valid categories.
  91. MUNIN_CATEGORY = 'network'
  92. # Database settings for Mumble-Django's database. These do NOT need to point to Murmur's database,
  93. # Mumble-Django should use its own!
  94. DATABASE_ENGINE = 'sqlite3'
  95. DATABASE_NAME = join( MUMBLE_DJANGO_ROOT, 'mumble-django.db3' )
  96. DATABASE_USER = ''
  97. DATABASE_PASSWORD = ''
  98. DATABASE_HOST = ''
  99. DATABASE_PORT = ''
  100. # Show debug information on errors?
  101. DEBUG = True
  102. TEMPLATE_DEBUG = DEBUG
  103. ADMINS = (
  104. # ('Your Name', 'your_email@domain.com'),
  105. )
  106. MANAGERS = ADMINS
  107. # Local time zone for this installation. Choices can be found here:
  108. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  109. # although not all choices may be available on all operating systems.
  110. # If running in a Windows environment this must be set to the same as your
  111. # system time zone.
  112. TIME_ZONE = 'Europe/Berlin'
  113. # Language code for this installation. All choices can be found here:
  114. # http://www.i18nguy.com/unicode/language-identifiers.html
  115. LANGUAGE_CODE = 'en-us'
  116. SITE_ID = 1
  117. # If you set this to False, Django will make some optimizations so as not
  118. # to load the internationalization machinery.
  119. USE_I18N = True
  120. # Absolute path to the directory that holds media.
  121. MEDIA_ROOT = join( MUMBLE_DJANGO_ROOT, 'htdocs' )
  122. # URL that handles the media served from MEDIA_ROOT.
  123. MEDIA_URL = MUMBLE_DJANGO_URL+'static/'
  124. # URL prefix for admin media -- CSS, JavaScript and images.
  125. ADMIN_MEDIA_PREFIX = MUMBLE_DJANGO_URL+'media/'
  126. # URL to the login view
  127. LOGIN_URL = MUMBLE_DJANGO_URL + 'accounts/login';
  128. LOGIN_REDIRECT_URL = MUMBLE_DJANGO_URL + 'accounts/profile';
  129. # Automatically generate a .secret.txt file containing the SECRET_KEY.
  130. # Shamelessly stolen from ByteFlow: <http://www.byteflow.su>
  131. try:
  132. SECRET_KEY
  133. except NameError:
  134. SECRET_FILE = join(MUMBLE_DJANGO_ROOT, '.secret.txt')
  135. try:
  136. SECRET_KEY = open(SECRET_FILE).read().strip()
  137. except IOError:
  138. try:
  139. from random import choice
  140. SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
  141. secret = file(SECRET_FILE, 'w')
  142. secret.write(SECRET_KEY)
  143. secret.close()
  144. except IOError:
  145. Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)
  146. # List of callables that know how to import templates from various sources.
  147. TEMPLATE_LOADERS = (
  148. 'django.template.loaders.filesystem.load_template_source',
  149. 'django.template.loaders.app_directories.load_template_source',
  150. )
  151. MIDDLEWARE_CLASSES = (
  152. 'django.middleware.common.CommonMiddleware',
  153. 'django.contrib.sessions.middleware.SessionMiddleware',
  154. 'django.middleware.locale.LocaleMiddleware',
  155. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  156. )
  157. ROOT_URLCONF = 'pyweb.urls'
  158. TEMPLATE_DIRS = (
  159. # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  160. # Always use forward slashes, even on Windows.
  161. # Don't forget to use absolute paths, not relative paths.
  162. join( MUMBLE_DJANGO_ROOT, 'pyweb', 'templates' ),
  163. )
  164. TEMPLATE_CONTEXT_PROCESSORS = (
  165. "django.core.context_processors.auth",
  166. "django.core.context_processors.debug",
  167. "django.core.context_processors.i18n",
  168. "django.core.context_processors.media",
  169. 'processors.installed_apps',
  170. )
  171. TEST_RUNNER = 'mumble.testrunner.run_tests'
  172. TEST_MURMUR_LAB_DIR = join( dirname(MUMBLE_DJANGO_ROOT), 'murmur' );
  173. TEST_MURMUR_FILES_DIR = join( MUMBLE_DJANGO_ROOT, 'testdata' );
  174. INSTALLED_APPS = [
  175. 'django.contrib.auth',
  176. 'django.contrib.admin',
  177. 'django.contrib.contenttypes',
  178. 'django.contrib.sessions',
  179. 'django.contrib.sites',
  180. 'registration',
  181. 'mumble',
  182. ]
  183. def modprobe( name ):
  184. """ Try to import the named module, and if that works add it to INSTALLED_APPS. """
  185. try:
  186. __import__( name )
  187. except ImportError:
  188. pass
  189. else:
  190. INSTALLED_APPS.append( name )
  191. # Check if rosetta is available.
  192. # http://code.google.com/p/django-rosetta
  193. modprobe( "rosetta" )
  194. # Check if django_extensions is available.
  195. modprobe( "django_extensions" )