settings.py 8.2 KB

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