settings_base.py 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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 = True
  10. ADMINS = (
  11. # ('Your Name', 'your_email@example.com'),
  12. )
  13. MANAGERS = ADMINS
  14. DATABASES = {
  15. # Database hosted on vagant test box
  16. 'default': {
  17. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  18. 'NAME': 'coin',
  19. 'USER': 'coin',
  20. 'PASSWORD': 'coin',
  21. 'HOST': 'localhost', # Empty for localhost through domain sockets
  22. 'PORT': '15432', # 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.7/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. 'netfields',
  122. # Uncomment the next line to enable admin documentation:
  123. #'django.contrib.admindocs',
  124. 'polymorphic',
  125. # 'south',
  126. 'autocomplete_light', #Automagic autocomplete foreingkey form component
  127. 'activelink', #Detect if a link match actual page
  128. 'coin',
  129. 'coin.members',
  130. 'coin.offers',
  131. 'coin.billing',
  132. 'coin.resources',
  133. 'coin.reverse_dns',
  134. 'coin.configuration',
  135. 'coin.isp_database',
  136. )
  137. EXTRA_INSTALLED_APPS = tuple()
  138. # A sample logging configuration. The only tangible logging
  139. # performed by this configuration is to send an email to
  140. # the site admins on every HTTP 500 error when DEBUG=False.
  141. # See http://docs.djangoproject.com/en/dev/topics/logging for
  142. # more details on how to customize your logging configuration.
  143. LOGGING = {
  144. 'version': 1,
  145. 'disable_existing_loggers': False,
  146. 'formatters': {
  147. },
  148. 'filters': {
  149. 'require_debug_false': {
  150. '()': 'django.utils.log.RequireDebugFalse'
  151. }
  152. },
  153. 'handlers': {
  154. 'mail_admins': {
  155. 'level': 'ERROR',
  156. 'filters': ['require_debug_false'],
  157. 'class': 'django.utils.log.AdminEmailHandler'
  158. },
  159. 'console': {
  160. 'class': 'logging.StreamHandler',
  161. },
  162. },
  163. 'loggers': {
  164. 'django.request': {
  165. 'handlers': ['mail_admins'],
  166. 'level': 'ERROR',
  167. 'propagate': True,
  168. },
  169. 'django': {
  170. 'handlers': ['console'],
  171. 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
  172. },
  173. "coin.billing": {
  174. 'handlers': ['console'],
  175. 'level': 'INFO',
  176. }
  177. }
  178. }
  179. TEMPLATE_CONTEXT_PROCESSORS = (
  180. "django.contrib.auth.context_processors.auth",
  181. "django.core.context_processors.debug",
  182. "django.core.context_processors.i18n",
  183. "django.core.context_processors.media",
  184. "django.core.context_processors.static",
  185. "django.core.context_processors.tz",
  186. "django.core.context_processors.request",
  187. "coin.isp_database.context_processors.branding",
  188. "coin.context_processors.installed_apps",
  189. "django.contrib.messages.context_processors.messages")
  190. AUTH_USER_MODEL = 'members.Member'
  191. AUTHENTICATION_BACKENDS = (
  192. 'django.contrib.auth.backends.ModelBackend',
  193. )
  194. TEST_RUNNER = 'django.test.runner.DiscoverRunner'
  195. GRAPHITE_SERVER = "http://localhost"
  196. # Configuration for outgoing emails
  197. #DEFAULT_FROM_EMAIL = "coin@example.com"
  198. #EMAIL_USE_TLS = True
  199. #EMAIL_HOST = "smtp.chezmoi.tld"
  200. # Do we use LDAP or not
  201. LDAP_ACTIVATE = False
  202. # Not setting them results in NameError
  203. LDAP_USER_BASE_DN = None
  204. VPN_CONF_BASE_DN = None
  205. # Membership configuration
  206. # Default cotisation in €, per year
  207. MEMBER_DEFAULT_COTISATION = 20
  208. # Link to a page with information on how to become a member or pay the
  209. # membership fee
  210. MEMBER_MEMBERSHIP_INFO_URL = ''
  211. # Pattern used to display a unique reference for any subscription
  212. # Helpful for bank wire transfer identification
  213. SUBSCRIPTION_REFERENCE = 'REF-{subscription.offer.reference}-{subscription.pk}'
  214. # Payment delay in days
  215. PAYMENT_DELAY = 30
  216. # Reset session if cookie older than 2h.
  217. SESSION_COOKIE_AGE = 7200
  218. # RSS/Atom feeds to display on dashboard
  219. # feed name (used in template), url, max entries to display
  220. # "isp" entry gets picked automatically in default index template
  221. FEEDS = (
  222. ('ffdn', 'http://www.ffdn.org/fr/rss.xml', 3),
  223. # ('isp', 'http://isp.example.com/feed/', 3),
  224. )
  225. # Member can edit their own data
  226. MEMBER_CAN_EDIT_PROFILE = False
  227. # Allows to deactivate displays and calculations of balances.
  228. HANDLE_BALANCE = False