1
0

settings.py 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. import os
  4. import ldap
  5. # Django settings for coin project.
  6. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  7. BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  8. PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
  9. DEBUG = TEMPLATE_DEBUG = False
  10. ADMINS = (
  11. # ('Your Name', 'your_email@example.com'),
  12. )
  13. MANAGERS = ADMINS
  14. DATABASES = {
  15. # Base de donnée du SI
  16. 'default': {
  17. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  18. 'NAME': 'coin',
  19. 'USER': 'coin',
  20. 'PASSWORD': '',
  21. 'HOST': '', # Empty for localhost through domain sockets
  22. 'PORT': '', # Empty for default
  23. },
  24. }
  25. # Hosts/domain names that are valid for this site; required if DEBUG is False
  26. # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
  27. ALLOWED_HOSTS = []
  28. # Enable strong authentication (username + password + OTP)
  29. # when enabled, strong authentication is done via a Yubikey hardware token
  30. # OTP is validated by a local or a remote service (configuration is done
  31. # through django admin pages)
  32. ENABLE_STRONG_AUTH = False
  33. # Local time zone for this installation. Choices can be found here:
  34. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  35. # although not all choices may be available on all operating systems.
  36. # In a Windows environment this must be set to your system time zone.
  37. TIME_ZONE = 'Europe/Paris'
  38. # Language code for this installation. All choices can be found here:
  39. # http://www.i18nguy.com/unicode/language-identifiers.html
  40. LANGUAGE_CODE = 'fr-fr'
  41. SITE_ID = 1
  42. # If you set this to False, Django will make some optimizations so as not
  43. # to load the internationalization machinery.
  44. USE_I18N = True
  45. # If you set this to False, Django will not format dates, numbers and
  46. # calendars according to the current locale.
  47. USE_L10N = True
  48. # If you set this to False, Django will not use timezone-aware datetimes.
  49. USE_TZ = True
  50. # Default URL for login and logout
  51. #LOGIN_URL = '/members/login_otp'
  52. LOGIN_URL = '/members/login'
  53. OTP_LOGIN_URL = '/members/login_otp'
  54. LOGIN_REDIRECT_URL = '/members'
  55. LOGOUT_URL = '/members/logout'
  56. # Absolute filesystem path to the directory that will hold user-uploaded files.
  57. # Example: "/var/www/example.com/media/"
  58. MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
  59. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  60. # trailing slash.
  61. # Examples: "http://example.com/media/", "http://media.example.com/"
  62. MEDIA_URL = '/media/'
  63. # Absolute path to the directory static files should be collected to.
  64. # Don't put anything in this directory yourself; store your static files
  65. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  66. # Example: "/var/www/example.com/static/"
  67. STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
  68. # URL prefix for static files.
  69. # Example: "http://example.com/static/", "http://static.example.com/"
  70. STATIC_URL = '/static/'
  71. # Additional locations of static files
  72. STATICFILES_DIRS = (
  73. # Put strings here, like "/home/html/static" or "C:/www/django/static".
  74. # Always use forward slashes, even on Windows.
  75. # Don't forget to use absolute paths, not relative paths.
  76. )
  77. # List of finder classes that know how to find static files in
  78. # various locations.
  79. STATICFILES_FINDERS = (
  80. 'django.contrib.staticfiles.finders.FileSystemFinder',
  81. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  82. #'django.contrib.staticfiles.finders.DefaultStorageFinder',
  83. )
  84. # Location of private files. (Like invoices)
  85. # In production, this location should not be publicly accessible through
  86. # the web server
  87. PRIVATE_FILES_ROOT = os.path.join(BASE_DIR, 'smedia/')
  88. # Backend to use when sending private files to client
  89. # In production, must be sendfile.backends.xsendfile with Apache xsend file mod
  90. # Or failing xsendfile, use : sendfile.backends.simple
  91. # https://github.com/johnsensible/django-sendfile
  92. SENDFILE_BACKEND = 'sendfile.backends.development'
  93. # Make this unique, and don't share it with anybody.
  94. SECRET_KEY = '!qy_)gao6q)57#mz1s-d$5^+dp1nt=lk1d19&9bb3co37vn)!3'
  95. # List of callables that know how to import templates from various sources.
  96. TEMPLATE_LOADERS = (
  97. 'django.template.loaders.filesystem.Loader',
  98. 'django.template.loaders.app_directories.Loader',
  99. #'django.template.loaders.eggs.Loader',
  100. )
  101. MIDDLEWARE_CLASSES = (
  102. 'django.middleware.common.CommonMiddleware',
  103. 'django.contrib.sessions.middleware.SessionMiddleware',
  104. 'django.middleware.csrf.CsrfViewMiddleware',
  105. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  106. 'django_otp.middleware.OTPMiddleware',
  107. 'django.contrib.messages.middleware.MessageMiddleware',
  108. # Uncomment the next line for simple clickjacking protection:
  109. # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  110. )
  111. ROOT_URLCONF = 'coin.urls'
  112. # Python dotted path to the WSGI application used by Django's runserver.
  113. WSGI_APPLICATION = 'coin.wsgi.application'
  114. TEMPLATE_DIRS = (
  115. # Only absolute paths, always forward slashes
  116. os.path.join(PROJECT_PATH, 'templates/'),
  117. )
  118. INSTALLED_APPS = (
  119. 'django.contrib.auth',
  120. 'django.contrib.contenttypes',
  121. 'django.contrib.sessions',
  122. 'django.contrib.sites',
  123. # LDAP as database backend
  124. 'ldapdb',
  125. 'django.contrib.messages',
  126. 'django.contrib.staticfiles',
  127. # same as django.contrib.admin but without autodiscover() call :
  128. # https://docs.djangoproject.com/en/dev/ref/contrib/admin/#discovery-of-admin-files
  129. 'django.contrib.admin.apps.SimpleAdminConfig',
  130. # Uncomment the next line to enable admin documentation:
  131. #'django.contrib.admindocs',
  132. 'polymorphic',
  133. # 'south',
  134. #Automagic autocomplete foreingkey form component
  135. 'autocomplete_light',
  136. #Detect if a link match actual page
  137. 'activelink',
  138. 'coin',
  139. 'coin.members',
  140. 'coin.offers',
  141. 'coin.billing',
  142. 'coin.resources',
  143. 'coin.reverse_dns',
  144. 'coin.configuration',
  145. 'coin.vpn',
  146. 'coin.isp_database',
  147. 'django_otp',
  148. 'otp_yubikey'
  149. )
  150. # A sample logging configuration. The only tangible logging
  151. # performed by this configuration is to send an email to
  152. # the site admins on every HTTP 500 error when DEBUG=False.
  153. # See http://docs.djangoproject.com/en/dev/topics/logging for
  154. # more details on how to customize your logging configuration.
  155. LOGGING = {
  156. 'version': 1,
  157. 'disable_existing_loggers': False,
  158. 'filters': {
  159. 'require_debug_false': {
  160. '()': 'django.utils.log.RequireDebugFalse'
  161. }
  162. },
  163. 'handlers': {
  164. 'mail_admins': {
  165. 'level': 'ERROR',
  166. 'filters': ['require_debug_false'],
  167. 'class': 'django.utils.log.AdminEmailHandler'
  168. }
  169. },
  170. 'loggers': {
  171. 'django.request': {
  172. 'handlers': ['mail_admins'],
  173. 'level': 'ERROR',
  174. 'propagate': True,
  175. },
  176. }
  177. }
  178. TEMPLATE_CONTEXT_PROCESSORS = (
  179. "django.contrib.auth.context_processors.auth",
  180. "django.core.context_processors.debug",
  181. "django.core.context_processors.i18n",
  182. "django.core.context_processors.media",
  183. "django.core.context_processors.static",
  184. "django.core.context_processors.tz",
  185. "django.core.context_processors.request",
  186. "coin.isp_database.context_processors.branding",
  187. "django.contrib.messages.context_processors.messages")
  188. AUTH_USER_MODEL = 'members.Member'
  189. AUTHENTICATION_BACKENDS = (
  190. 'django.contrib.auth.backends.ModelBackend',
  191. )
  192. TEST_RUNNER = 'django.test.runner.DiscoverRunner'
  193. GRAPHITE_SERVER = "http://localhost"
  194. # Configuration for outgoing emails
  195. #DEFAULT_FROM_EMAIL = "coin@example.com"
  196. #EMAIL_USE_TLS = True
  197. #EMAIL_HOST = "smtp.chezmoi.tld"
  198. # Do we use LDAP or not
  199. LDAP_ACTIVATE = False
  200. # Not setting them results in NameError
  201. LDAP_USER_BASE_DN = None
  202. VPN_CONF_BASE_DN = None
  203. # Membership configuration
  204. # Default cotisation in €, per year
  205. MEMBER_DEFAULT_COTISATION = 20
  206. # Link to a page with information on how to become a member or pay the
  207. # membership fee
  208. MEMBER_MEMBERSHIP_INFO_URL = '#'
  209. # Reset session if cookie older than 2h.
  210. SESSION_COOKIE_AGE = 7200
  211. # RSS/Atom feeds to display on dashboard
  212. # feed name (used in template), url, max entries to display
  213. # "isp" entry gets picked automatically in default index template
  214. FEEDS = (
  215. ('ffdn', 'http://www.ffdn.org/fr/rss.xml', 3),
  216. # ('isp', 'http://isp.example.com/feed/', 3),
  217. )
  218. # Surcharge les paramètres en utilisant le fichier settings_local.py
  219. try:
  220. from settings_local import *
  221. except ImportError:
  222. pass